Smooth edged texCUBElod

Yep sun diffuse tints the sky, well clouds, so breaks things.

Using a HDR image, tone mapping linearly so you capture a good dynamic range, then scaling the clouds value in racer is good. Have it fill the sky (no blending) and use a value like say 8 for clouds.
The result looks good. Issue is you need to tweak sky.cg so there is no sun influence on it.

You can balance to this really nicely and it just looks so natural!

Main issue then is tweaking mie ray and extinction to blend nicely with your sky at the horizon...

Oh for this HDR sky map support to be finished. Fixed TOD makes a lot of sense unless you are willing to invest serious time to make it work, and IMO the system itself is still not right, never mind us as authors struggling with it :)

Dave
 
OK so it's easy enough to remove the sun spot from the envmap, without turning sunny=0;

The sun is drawn on in atmosphere.cg

Code:
  //float miePhase=sunny*0.000079577471636878192976419142055225*atmosMie*((1-g)*(1-g))/pow((1+g2-2*g*cos),1.5);
  float miePhase=0;

So that fixes that.

Now in theory we have the ambient and diffuse separated out to be dealt with uniquely in two different ways, and blended in between.



Now my quick thoughts.

Is there any way to make specular obey the fresnel we define in a shader?

Since specular and envmap reflections are one in the same, they should obey the same fresnel rule.

Is there any way to add a second specular term, mainly for car paints? We often use a soft specular to add a subtle metallic look or pearl look to the paint base coat... but it'd make sense to give that a fresnel too.

Ie, fresnel0...99 specular0...99, and have each one apply to the corresponding layer in the shader.

Also thinking that for fixed TOD it's probably possible (for most purposes) to bake out an appropriate map (LDR) and then calibrate it using the spheres method against the HDR envmap in game. That way we can just have a small cube map that can be used for semi-glossy materials on tracks, stuff like track surfaces (where glossy or smooth etc). (more ideal would be being able to save a HDR cube map and use mips of it)


Just trying to figure out how we conserve energy between a chrome ball and a matte steel ball.
We obviously slowly move from a super sharp specular highlight (the sun reflection), and the envmap (without the sun in it), through to basically being just the diffuse/ambient terms, and specular and glossiness slowly move from high values to very low values (effectively 0) as we hit a lambertian material. So diffuse/ambient move from 0 > 1, and spec/gloss from 1 > 0, and also envmap reflection scaled appropriately from 1 > 0...


There must be one big equation that covers the whole reflection/illumination values from glossy to matte and can control the variables appropriately as you move between them?!

Would make life nice to be able to just paint a gloss texture for our surfaces and Racer manage it all automatically. Paint a glossy surface and we get reflections and specular proper for that surface, paint a matte surface and get specular/diffuse appropriate for that surface and so on.

Hmmmm...


Maybe all a bit too much for Racer, but I certainly think the specular will be better done with fresnels.
Also support from more than one specular (so one per layer if needed (mainly just car paints and wet roads etc where we have a clear coat over another material))...

Worst case we can manage energy conservation ourselves, but best to start with consistent approaches to how we apply energy to begin with (fresnel and bung specular in place of the sun spot in the envmap :D )

Dave
 
For the 'sharp' fresnel it might make sense to just use the configuration from the reflections - it is, really, just the reflection of the sun that happens to be so bright that it blows out into a larger soft spot than the pure reflection of the sun. mipmap_bias can with some work be converted into a 'shininess' size that works right, and then the specular terms can refer to the response on the base paint layer. As you observed the gloss/envmap are pretty much linked, since the primary response of both is off the clearcoat.

If the specular response is added to the reflection at the right time, it probably gets fresnel for free - as the reflection's already being mixed into the colour using fresnel response.
Code:
  float3 envColor=texCUBE(envMap,IN.R);
...
  float3 litColor=baseCol*diffuse+specular*reflectiveNess;
Obviously we don't want specular showing up on the parts of the car that are in shadow, unlike the reflection, but I believe the 'shadow' variable already contains that info.
Code:
  float3 litColor=baseCol*diffuse;
  envColor = envColor + specular*reflectiveNess*shadow;
This should be about right, subject to mistakes in the code...

The first specular term is calculated in LightingSun() so it might just be a matter of taking that function, stripping out all non-specular calculations, and ending up with something dedicated to specular spots.
 
Hmmm ok so you are adding specular into the reflection pass.

Problem is what about materials not using reflection?

Assuming right now we just want to have specular use a fresnel as well as reflection type materials?


Cam, I'm not sure if it's the same as BRDF, I think that is kinda something else again.

This approach is more along the lines of diff/gloss/spec/bump which many game engines use these days... seems a fairly standard system for most props/environments. It can be scaled up or down using just diff, then diff/spec, and so on, and the inputs can range from good old diff/amb/spec through to envmap cube map inputs etc...

In practice it scales well and reacts nicely across varying input qualities.


I just keep seeing asphalt, say on Top Gear last night. It looks grey one minute, blue another, black another, white another.
I know image processing will change the apparent look, and so will the wet road or dry road, or the blue sunset sky and orange sun, or the overcast clouds... but that is the problem... our Racer materials just can't respond to all these variables elegantly.

We can fudge/tweak materials to look right but it makes no sense if someone tries to copy it and use it elsewhere with a different texture. Everything is balanced and so it's not useful for other artists to copy.


Racer in the past struggled because EVERY author (me included, no one knew better, we just copied each other) would set a car emission value really high to make them show up in the shaded side. The problem was that track authors set very low ambient values.

We persisted with that oddity of lighting because every track was wrong, so every car was wrong. Had we known and changed it Racer would have looked better in the old days than it did, but we didn't know :)


I think we have an opportunity here to make a better balanced shader system that just reacts better all the time.
We can feed it basic inputs or feed it envmaps or cube maps, we can let it run basic shaders or more complex ones and it'll scale nicely if we offer it more textures to reference.

Anyone can pick it up and use it, and if they use the right texture it'll look right. No need to balance ambient/spec/reflection amount off against each other manually.

Right now I might take an hour balancing the settings for a material, and even then it might only look ok with my TOD settings and sky image.

As soon as another user picks it up and tries to copy it it may not work right on their snowy track, or raining course...



Just aiming to make making better content easier.

When I get the chance I'll have a read up but ultimately I'm not a shader expert (at least in coding them)...
I just think we have all the ingredients here right now. Bar a few hard-coded elements Ruud could add, it's just code mainly I think!

Dave
 
I think it's better to set up some good standards than to enforce particular limits - for example, car bodylines are not really a material at all, they should have 0 illumination on any counts because they're textured gaps, so they would violate whatever rules we came up with for diffuse/spec/ambient balance.

Ran into http://refractiveindex.info/ - has nice fresnel curve graphs for a whole variety of materials including some metals.
 
I think it's better to set up some good standards than to enforce particular limits - for example, car bodylines are not really a material at all, they should have 0 illumination on any counts because they're textured gaps, so they would violate whatever rules we came up with for diffuse/spec/ambient balance..

For old content yes. But nowadays, 3d bodylines are standard feature on models :)
 
For me cars are fairly easy generally even old updated ones.

Main probs for me are track materials that are semi glossy etc.

I'm struggling to make asphalt that just looks right hehe :)


I can balance values manually between reflection fresnel, spec etc but it just feels inefficient and will be tough for many to do well!

Lets see as we move forward I guess :)


Anyone know an easy way to add two speculars to a material, ie a soft one and a hard one?
Also any elegant way to use an old school fresnel alike texture (but coloured) to define colour of car paint with viewing angle?

Hmmmm...

Dave
 

Latest News

How long have you been simracing

  • < 1 year

    Votes: 359 15.7%
  • < 2 years

    Votes: 254 11.1%
  • < 3 years

    Votes: 245 10.7%
  • < 4 years

    Votes: 180 7.9%
  • < 5 years

    Votes: 302 13.2%
  • < 10 years

    Votes: 260 11.4%
  • < 15 years

    Votes: 166 7.3%
  • < 20 years

    Votes: 128 5.6%
  • < 25 years

    Votes: 99 4.3%
  • Ok, I am a dinosaur

    Votes: 295 12.9%
Back
Top