Pages: 1 ... 6 7 [8]
  Print  
Author Topic: GLSL  (Read 231633 times)
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #175 on: December 11, 2014, 10:51:20 AM »

I'm now attempting at trying to make 3dfx dither shaders for the textures, so there's the familiar artifacts of their overdraws and etc...

However I don't like how the vertex shader needs to calculate the colors, why can't I just use the CPU-calc'd colors directly for more compatibility? Sad  I also notice lightmaps disappear when I use it.  I based it off the old generic_fp/vp programs

Also it's a slow shader, but that doesn't take away from its intended appeal when additive overdraw brings back a nice fps dip Smiley
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #176 on: December 11, 2014, 01:32:14 PM »

...I realized I can just comment out the calc stuff and use gl_Color directly

same for the texcoord calcs, now I have lightmaps working
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #177 on: December 17, 2014, 01:35:49 PM »

hi fromhell!

I see you've been busy. I was away from OA for a while now. Back here now. Yes, the gl_color is correct (I realized that as well). Do you think I can try updating my github account so you can pull the changes?
Also, are you using the 'generic' glsl program at the moment?

Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #178 on: December 17, 2014, 01:40:59 PM »

No, i've pretty mcuh split that off into a leifxify_fp/vp shader now.  No vertex color calculations on shader since I only cared to just add dithering the textures instead


I have been way too busy in RL lately though so I haven't been working much on OA3 (RL xmasing)



Nevertheless I have been thinking of getting those generic shader programs to work again in a brute-force way to speed up the game a little as an option.  The real issue are porting those new rgbGen/alphaGen calculation functions over (new rgbGens for things like anime eyes, celshaded models and shiny models), so i'd have to leave them handled in software until then (one new calc function involves using specular for the overbright samples over a clamped lightingDiffuse)  
however vertex shader lighting is only half of the battle - another nice speedup would be from dropping unweighted bones from MDRs (my models have many of them for baked ik setups) at load and vertex shader skeletal frame interpolation.
« Last Edit: December 17, 2014, 07:19:16 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #179 on: January 12, 2015, 09:03:57 AM »

Experimenting with shading


I took most of the stuff from water_ glsl and actually took the tess normals as a color calc instead to get normal data to the shader system (lazy way to do it but works) leading to somewhat neat per-pixel shading

Not as smooth as Dolphin's though... but this is still a nice step closer to a generic perpixel lightingDiffuse shader idea I wanted a year ago without the regressive sacrifices that renderergl2 does.  I'll probably keep adjusting until it looks more like TF2's shader


what the shader system REALLY needs though, are FBOs - so we could have refracting effects done right and other effects
« Last Edit: January 12, 2015, 07:18:54 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #180 on: January 13, 2015, 05:59:07 AM »

Made even more progress. Specular and diffuse light reflect properly from the directedlight vector, and there's specular mask/hardness support, and I added a touch of 'rim lighting'


I really like how this looks too, and the normals don't look so bad either! (contrary to every time I tried renderergl2 in the past)


I'm going to make this a cvar too - r_modelshader, which when set to 1, applies this particular shader on all lightingDiffuse stages if they don't have a glsl shader already
« Last Edit: January 13, 2015, 06:19:16 AM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Suicizer
Member
Member
*

Cakes 2
Posts: 402


WWW
« Reply #181 on: January 13, 2015, 12:32:50 PM »

Made even more progress. Specular and diffuse light reflect properly from the directedlight vector, and there's specular mask/hardness support, and I added a touch of 'rim lighting'


I really like how this looks too, and the normals don't look so bad either! (contrary to every time I tried renderergl2 in the past)


I'm going to make this a cvar too - r_modelshader, which when set to 1, applies this particular shader on all lightingDiffuse stages if they don't have a glsl shader already

Looks nice and wet; awesome.
So, when will OA3 actually be released?
Logged

I'm good at everything but can't do anything...
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #182 on: January 13, 2015, 06:38:49 PM »

Hi,

I've deleted the old fork and created a new one from the engine master. Added my changes (though they are not final-final - need checking what works correctly and what not.. i.e. tangents, environment texture calculation, ...). https://github.com/oahitchhiker/engine/
but might give you some ideas and show where my fork is going.
The 'generic' glsl program is changed in my version. here attached is glsl folder that I'm using at the moment (should go inside the pk3 file).

There is a working postprocessing multipart in this fork. the post effects that should be included should be called 'fxname'_post.glsl and loaded with r_postprocess_multi fx1+fx2+fx3... you can try loading one which is called 'ls' with '/r_postprocess_multi ls'

all this is work in progress mainly because the glsl programs are not implemented completely. there are probably a thing or two still in the engine source itself that will need changing (and few checks added so i.e. one could not load 20 fx parts in the multipart postprocess pipe and crash the game).

there are new glsl attributes available (normals, tangents and binormals).. few other things as well but first I'll need to clean the source and the glsl programs before moving forward to explaining each little detail.

posting here just in case anyone wants to try how it looks.

few screenshot as well:

Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #183 on: January 13, 2015, 09:51:40 PM »

What about deluxemaps being compiled into BSPS? Q3Map2 is capable of that and is used to optimize realtime lighting rendering in Darkplaces.

and FBOs? so refracting shaders and the like etc. could work?
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #184 on: January 14, 2015, 12:46:08 PM »

I think VBO would be a good addition to the renderer as well as glsl based calculations or vertex positions / colors (the later being done on the CPU at the moment) as they would increase the rendering speed - at the moment glsl path is always going to be slower I fear.
FBO.. yes, why not. But I'm sorry to say I'm not up to it at the moment (lack knowledge). Speaking of this.. I did look in the past at the deluxe maps.. never did figure out what they are Sad

Logged
grey matter
Member


Cakes 8
Posts: 381

>9k


« Reply #185 on: January 14, 2015, 12:51:57 PM »

I think VBO would be a good addition to the renderer [..]
FBO.. yes, why not. But I'm sorry to say I'm not up to it at the moment (lack knowledge).
disclaimer: I know nothing about OpenGL; but the "fbo", "vbo" keywords are present in ioq3's "renderergl2". Might be worth taking a look so you don't have to re-implement everything for "renderer_oa".
Logged

This space is for rent.
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #186 on: January 14, 2015, 05:42:33 PM »

There is some point in the rewriting in renderer_oa though - compatibility.  I'd rather have the shader stuff switchable in the same module without maintaining separate code directories. Maybe the GL2 stuff can be all stuck in #ifdef's to make a more stripped renderer_oa as an option.

Also some of the VBO stuff rgl2 has already isn't very useful for where OA3 is heading (MDR models are skeletally animated and are not vertex cached)



and i'm generally paranoid about potential license issues of renderergl2's vertex/fragment shader code given all those cited sources from other pages on the internet
« Last Edit: January 14, 2015, 05:52:16 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #187 on: January 15, 2015, 04:12:09 PM »

Thanks for helping, grey matter. I have seen those as well but if I recall correctly the VBO implementation there is not compatible with all the available mods/model animations (as fromhell says). FBO part might be possible to copy/adapt and keep the compatibility as, as far I can estimate, FBO would only affect the process of drawing of the pixels on the screen (as opposed to VBO(s) which are involved in preparing and dealing with the 3d objects' data - vertexes and polygons ; in renderergl2 VBOs seems do not fully support all of the Q3/OA vertex transformations).
One part of the renderergl2 that could be useful and easier to adapt (or to be used for guidelines how to do it in OA renderer) is the shadows part (at least to have those for one light source i.e. the Sun). But as light of the sun (and shadowed parts) is already calculated/included in the lightmaps - adding a second shadow would darken parts that are in the shade a little too much. But possibly the shadows generated this way could be soft ones (sort of just a hint of shading) so this darkening effect would not be that obvious..
But my first thing at the moment is to bring the glsl to a usable level. Once this is done we'll see how much interest there will be for adding new features to the renderer.
As for the glsl programs, I don't think the license will be an issue but will take care not to copy paste things that are not clearly marked as public domain, MIT or BSD - everything else I might include there will be written from scratch (not copied).


Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #188 on: January 15, 2015, 05:45:33 PM »

I wouldn't mind shadowmapping, though the shadowmap would need to be in a shader along with the lightmap somehow.  Even shadowmaps that are literally the same as the stencil shadow system (projecting shadows from lightdirection) as it is now are welcome, though maybe with a depth fix so there isn't a super stretched shadow.

FUN FACT: I contacted xTibor to free up his dither shader on Shadertoy before I could use it for my leifx shader.  His very handy ordered dither shader is now in public domain.



« Last Edit: January 15, 2015, 08:14:55 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #189 on: January 19, 2015, 02:28:04 PM »

Cool! Thanks to xTibor! Smiley

for shadowmaps.. yes, they would be added to the existing calculations - would be good as they would provide self shadowing I think and generally increase visual appeal.

at the moment I am trying to get the models (Dark) shaded using fromhell's normal maps. here two screenshots (one with strong moonlight and one with less).

also, p.s., my Github fork actually crashes if r_ext_vertex_shaders is set to 0. Should be a simple fix.. but if someone is trying to start it, make sure you have that cvar set to 1. So this is why there is no non-glsl version of Dark here for comparison Smiley.

Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #190 on: January 19, 2015, 04:45:41 PM »

Doesn't crash for me since I stick ext_vertex_shader checks in my glsl-related functions.

btw what's up with her face and her left breast?


BTW here's my GLSL shaders so far.  There's no real normal mapping calcs in it yet and it does run slightly slower than the normal calcdiffusecolor because of the color processing on the diffuse texture to become non-working heightmaps and specmasks.  It also doesn't yet support multitexturing yet so it breaks a lot of shader'd models Sad
« Last Edit: January 19, 2015, 04:55:33 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #191 on: January 20, 2015, 12:05:26 PM »

I'm not sure about the artifacts - possibly my tangent/normal calculations are a lil' off - will check it. I did have to invert the normal map (add - sign to its value) to have it light correctly so possibly there is something there as well. Also normal come in few flavors as well it seem (tangent space, world space, etc... at least in Blender it is possible to choose a different normal space when baking high poly to low) so possibly something there as well? I'll double check on my end and let you know what I find.

I'll also check your shaders - maybe I can help with them.
Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #192 on: January 27, 2016, 12:18:08 PM »

I have to mention all of this postprocess fun stuff doesn't work properly with super high resolutions (i.e. 2560x1440, 3200x1800, etc). Just blackscreens or crashes.

It probably needs to be a proper framebuffer object for all that to work
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #193 on: January 28, 2016, 04:00:05 PM »

how do you test with those resolutions? I'll try on my end.. I guess windowed mode?
Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #194 on: January 28, 2016, 04:36:17 PM »

virtual super resolution in crimson driver Smiley
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #195 on: January 29, 2016, 12:40:56 PM »

uh-oh.. virtual what? Smiley
ok, pls let me check ...
Logged
Hitchhiker
Member


Cakes 11
Posts: 181


« Reply #196 on: January 31, 2016, 03:42:59 PM »

Hi!
seems this is an AMD feature so I cannot test. As for crashes, I could reproduce this in windowed mode so will try to find which line of the code does that. As for blackscreens I don't see why this would happen on high res screens (possibly the texture required for the effect to work is never initialized) - another check to add to the code if is not there already. Either way it will require some debugging.
Do these errors appear with the 0.88 version or just the latest one?

Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #197 on: January 31, 2016, 06:20:04 PM »

This one.
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Pages: 1 ... 6 7 [8]
  Print  
 
Jump to: