The shader thread?

I'm messing with shaders a bit right now.

Right now I am looking specifically at adding control for specular to the existing reflect shader... on Deyan's Murcielago the unified wheel/tyre texturing poses some problems.

I have to control reflection strength with an alpha map, so use the old trick of adding a syntax in the reflection shader so if we define reflection = -1, the baseCol.a is used to control reflection strength.

ambientColor=FresnelMix(ambientColor,envColor.rgb,(Kr>0?Kr:-Kr*baseCol.a),fresnel);


The problem now is that I have no spare texture slot for specular/shininess control.

So I have added this little fragment of code (from the bump speca shader)

Ks=baseCol*Ks;

This now allows the colouring of the outside of the tyre in the diffuse (rgb) channels, to do some work.



However, because the tyre is still dark in the diffuse texture (near black as it is a tyre), it doesn't have much effect on it's own.

I need to somehow increase the brightness of the texture so Racer pumps up the specular we see.

So I added a *5 multiplier to the Ks as you can see in the image attached.

shader_01.gif




Now what I don't understand is why the two images look different.

First case:
Ks in car.shd is 8, while Ks = baseCol * Ks * 5 essentially gives us Ks = baseCol * 40

Second case:
Ks in car.shd is 40, while Ks = baseCol * Ks essentially gives us Ks = baseCol * 40


Now, I don't get why they look different. Ks is meant to control the size of the specular too, but in either case they both calculate out to a peak shininess of 40, because the baseCol lookup isn't changing.
The specular settings remain the same.

It appears that multiplying by 5 in the shader means the specular level is pumped up 5x, while the shininess (size of the specular) is retained at 8 in the car.shd...

That is the effect I wanted to achieve, pumping up the actual output of the specular blob, while keeping it soft at a value of 8, but it seems un-intuitive/wrong because the value that really needs bumping up is the specular value, not shininess? (though the specular being multiplied by 5x (2.5 2.5 2.5) looked awful)

Am I missing something obvious here?




Ideally I'd like to control reflection amount, specular AND shininess using one shader here...

Probably using rgb.a for diffuse.reflection strength, and then another 3 channel texture for spec/shine and leaving another slot free for something else (perhaps transparrency?)

Specular/shininess maps add so much to these kinds of materials, so it is a shame that they haven't really been considered in the default shaders very much. I think they should almost be defaults in all materials that err away from being generally reflective (ie, using the envmap)


Bodging in the code I have for the Lambo works quite nicely in this case, but it's obviously not ideal to use the diffuse channel to control specular in this way.



Hmmmm

Dave
 
Tried ver 0.0818 straight out of the box and got terrible results as I cycled thru 24 hours, purple track just doesn't look good!

Tried the curves that worked fairly good in ver 0.0817 and it was marginally better. Sky stayed dark on my surfaces and sounds track no matter what I tried.

On carlswood got sudden intensity increases and there were locations where the shadows no longer appeared on the car!

It's a big bll of wax and if anyone has curves that work on carlswood please post them for us that aren't as expert in setting them, please!
 
where do i find information on how to create shaders for this game, my current format, doesnt use them...thank in advance for the info...can i get away without using them...or is that not possible
 
Hi Alex,

I'll post my curves/info here for what I have so far...

I have used this location/time for all my curves thus far.

year=2010
month=8
day=21
latitude=53.9240
longitude=-0.9888
timezone=1
azimuth_offset=0


Curves for a sunny clear day
www.gowhippy.com/racer/tod_clear.zip

Curves for a partial overcast day
www.gowhippy.com/racer/tod_partial_cloud.zip

My cloud map (panoramic)
www.gowhippy.com/racer/sky_day.zip

I make a pure black texture for the night map, for now.



To generate these I took 3DS Max2010 and used the IES sun/sky. The sun Lux values were given directly, but the sky ones had to be derived using the pseudo exposure controls to find the point where the shadow disappeared and thus determined it's lux intensity.
IES also gave tints for the values, so 255,242,230 for the sunlight, 242,242,255 for the sky, so I recreated the sun diffuse R curve then copied to the g/b curves and scaled appropriately, and did similar for the ambient curves. The tint seems to work ok, but having real colour info at a fixed white balance might be interesting to see. Does the sun really get orange at dusk, or is the sky just more orange, and how should we simulate that? Specular look not tinted enough, despite the sky being nicely tinted... should the specular actually be unlocked, or tied to the rendered appearance of the sun spot itself? Hmmmm...


All the values I have line up really nicely with what I have been collecting in real life, so that was reassuring... especially since my white matte ball (measuring off the top of the ball) was giving ~ 0.27 lumens when the sky cleared up an hour after sunset or so, and the almost full moon was out... almost exactly what wikipedia was saying for a full-moon lit night at mid-latitudes (also note I live in a village with a bit of street lighting etc leaking in I guess)


I also collected some data in real life last night around dusk, since it was clear that ambient light persisted a good hour after the sun had set... 3DS Max didn't really cover that base. However, it was partial cloud last night, so the numbers here were only added to the partial cloud cover TOD curve set (I use a partial overcast sky image with 'clouds=7' in the special.ini alongside the thunder/rain/snow variables for this partial overcast sky)
I think what is important is to remember that in Racer our matte materials have ambient occlusion faked with normal weighted ambient illumination, so measuring off the top of upward pointing objects is important for consistency I would think.



The curves are still not perfect. I really want to log sun/sky values right through a whole day and into the night (once they stay consistent for a good hour on a night then I'll stop) and then try capture a dawn to see if they are consistent with dusk, just backwards, or if they are different! It seems the bits around dusk/dawn are the hardest to get right...


Right now they are giving me ok results in Racer. The partial cover ones especially, since that is what we get in the UK most of the time and so they feel about right for what I see out on the road on other cars etc.

Just the exposure control needs some better logic I think. I'm not sure how that should work, but logic and common sense should prevail and aim to make it do what our eyes do, rather than try copy what a camera might do which doesn't see the roads exposure as most important, while to a driver it is the most important factor when driving :D



Dave
 
Thanks for the curves Dave. The link for the skydome is the same as for the tod_partial_cloud file.
Have you thought about putting a small hemispherical dome lens over your light meter? I think this
would let you get better readings at dusk and dawn.

Alex Forbin
 
Hi Alex,

The link is updated now!

As per the second thing. I have used a polystyrene sphere, and roughed it up a great deal. It seems a really nice diffuse material, as close to lambertian dispersion behaviour I can do for reasonable money I think!
I am then using the point meter on my SLR and converting back from that...

Very tempted to just buy a light meter though, I guess they are good at doing point sources (the sun), and the general sky dome (point straight up)?

They look to have a small semi-dome sensor, but no idea if this can be used as a point meter AND an ambient meter... which is kinda what I need. I can do much the same with my SLR by using point metering or full-scene metering on a wide-angle lens :)

Just the conversion from f-stop, iso and shutter speed might not be as good, but the numbers I'm getting seem pretty good so far :)

Dave
 
Testing the HDR encoded lightmaps:

screenshot001.jpg


screenshot002-1.jpg


Good color and lighting, very fast, although there is some pixel artifacts and currently it's not mixing with CSM

all rendered in racer engine, lightmap made with 3dsmax with IESun and mental Ray.
 
Hmmm, so what do light maps do for us?

I quite like the idea that the track is dynamic and changing all the time... a 2hr race that takes us from a sunny later afternoon into a sunset for the race finish... can light maps manage that kind of thing?

What information is a light map storing? Ambient occlusion type information?

Dave
 
The light map is static,but since it's done offline you can put lot's of fancy stuff in, like indirect illumination.
So a light map contains all the illumination infor (direct and indirect).

In the above test scene you can see the sun light bouncing between the boxes and give the ground shadow a yellow tint near the boxes. As racer does not support floating point texture atm, i use an approch to encode all the infor into a tga file, hopefully racer will support True hdr texture soon. The lightmap is the best approch considering quality/speed as many computing load are moved offline. Half life 2 and Unreal use this technique. And it's very common in console games. Recently title like mirror's edge and gt5 also use it and the result is quite amazing.

Racer could be a hybrid engine so both static and dynamic lighting can be supported.
 
The light map is static,but since it's done offline you can put lot's of fancy stuff in, like indirect illumination.
So a light map contains all the illumination infor (direct and indirect).

In the above test scene you can see the sun light bouncing between the boxes and give the ground shadow a yellow tint near the boxes. As racer does not support floating point texture atm, i use an approch to encode all the infor into a tga file, hopefully racer will support True hdr texture soon. The lightmap is the best approch considering quality/speed as many computing load are moved offline. Half life 2 and Unreal use this technique. And it's very common in console games. Recently title like mirror's edge and gt5 also use it and the result is quite amazing.

Racer could be a hybrid engine so both static and dynamic lighting can be supported.

Sounds like a better version of vertex lighting then...

So how does it get applied? Is a light map generated as another texture for every surface and object making them only good for static objects?
I guess the light map is kept seperate from the diffuse info so that when the object is in shade it uses the information more than when it is directly illuminated? Is a light map a bit more like a coloured radiosity map, vs an ambient occlusion map which is a single channel shadow type map?
I'm confused if you burn in the light info to match the sun position and sky colouring, so if the sun moves by 2-3hrs are all the shadings going to appear wrong?

Seems to have lots of pro's which become better and better with static light conditions, but as you want more dynamicism they become weaker and less useful.



A hybrid system sounds good, but is that something that should be desired for v0.9? As much as progress is important, it feels like we are just going back to the old ways again of tinkering as we go along rather than setting a clear target to meet.

Not that I'm massively fussed, just from a content creation point of view I keep having to stop and wait to see what is going to happen next and how it might effect how I do things, rather than just building for a fixed graphical environment...

Pre CSM I was planning on doing a fixed TOD and creating shadow planes for all my objects and items, and creating a higher mesh density and using vert baked light info. Then CSM came along, and now HDR, offering no need to do much of that, and a new focus on dynamic environments. Now we are talking about light maps and more static based optimisations again haha...

I have no idea which way to go now :D

Dave
 
Sounds like a better version of vertex lighting then...

...

Pre CSM I was planning on doing a fixed TOD and creating shadow planes for all my objects and items, and creating a higher mesh density and using vert baked light info. Then CSM came along, and now HDR, offering no need to do much of that, and a new focus on dynamic environments. Now we are talking about light maps and more static based optimisations again haha...

Now, that we have a pretty decent TOD, I really doubt the light mapping would be any good. I mean, where could you really use it in a racing game. In a FPS, sure, with lots of indoor environments and whatnot, it would look cool, but when things go by 100 mph you won't really notice.

I, for one, am in favor of complete "dynamicism" - no static light mapping or vertex lighting. Just create a track, set the lat-long and some other values and you're good to go. Even SSAO would probably be overkill for a racing game. Just realistic looking lighting and shadows is all we need! :)
 
Now, that we have a pretty decent TOD, I really doubt the light mapping would be any good. I mean, where could you really use it in a racing game. In a FPS, sure, with lots of indoor environments and whatnot, it would look cool, but when things go by 100 mph you won't really notice.

I, for one, am in favor of complete "dynamicism" - no static light mapping or vertex lighting. Just create a track, set the lat-long and some other values and you're good to go. Even SSAO would probably be overkill for a racing game. Just realistic looking lighting and shadows is all we need! :)

QFT

Since we're in the shader thread...does anyone still have that anisotropic shader everyone was working on when racer first started out with cg?
I'm gonna need one for my upcoming car...I also figured out how to make custom shaders work nicely inside the car folder so if Ruud doesn't decide to make it a default shader it'll still work fine. :)

1 Virtual beer to the person that gets it to me :D
 
Quantum Field Theory? :D

Since we're in the shader thread...does anyone still have that anisotropic shader everyone was working on when racer first started out with cg?
I'm gonna need one for my upcoming car...I also figured out how to make custom shaders work nicely inside the car folder so if Ruud doesn't decide to make it a default shader it'll still work fine. :)

1 Virtual beer to the person that gets it to me :D
Anisotropic shader? What did that do exactly?
 
Hehe...

I think once the shadows are settled (hopefully soon), and the shaders are refined and good types generated for all materials (almost there imo), then gfx would seem to be pretty much there bar bug-fixes etc, for a V0.9 release. It certainly has the potential to look good enough.
One thing that I do think is a bad area that could do with work though is transparrency. The dappled dots for transparrency does let things down a bit though. Not sure if that will ever go away, but GT5 P looks loads better for it's good glass vs Racer right now :D


Exploring new stuff will always be cool, but it doesn't help developers get stuff released into a stable enjoyable environment. I guess non-cg is that place, but non-cg never really reached a final point either because it just kinda moved into CG before settling to a standard as well.


I'm just looking forward to targetting a fixed gfx/physics system soon, and then enjoying Racer online with friends etc. I think it is what Racer really needs right now more than anything!

Dave
 
Hehe...

I think once the shadows are settled (hopefully soon), and the shaders are refined and good types generated for all materials (almost there imo), then gfx would seem to be pretty much there bar bug-fixes etc, for a V0.9 release. It certainly has the potential to look good enough.
One thing that I do think is a bad area that could do with work though is transparrency. The dappled dots for transparrency does let things down a bit though. Not sure if that will ever go away, but GT5 P looks loads better for it's good glass vs Racer right now :D

Dave

I'm beginning to think that Racers CG is seriously broken. I've tried everything to get some of my old shaders to look merely acceptable and have had no luck. It looks like when Ruud went to the K-lux system the shaders were somehow left out. Some cars will look fine in the preview window but look blown out ingame(pics 1.2.), others appear totally white in the preview and look like a toon shader ingame.(pics3.4)

Alex Forbin
 

Attachments

  • menu.jpg
    menu.jpg
    122.1 KB · Views: 236
  • screenshot002.jpg
    screenshot002.jpg
    157.8 KB · Views: 211
  • menu2.jpg
    menu2.jpg
    115.4 KB · Views: 208
  • screenshot003.jpg
    screenshot003.jpg
    157.1 KB · Views: 232

Latest News

What would make you race in our Club events

  • Special events

    Votes: 0 0.0%
  • More leagues

    Votes: 0 0.0%
  • Prizes

    Votes: 1 20.0%
  • Trophies

    Votes: 1 20.0%
  • Forum trophies

    Votes: 0 0.0%
  • Livestreams

    Votes: 1 20.0%
  • Easier access

    Votes: 4 80.0%
  • Other? post your reason

    Votes: 0 0.0%
Back
Top