Culled Detail-Texture VertexLit

Hi Guys,

for this project http://forum.unity3d.com/viewtopic.php?t=3321
I’m seeing a big interest in combining the following properties for a terrain shader :

  • backface culled
  • using a detail-texture (like the Diffuse/Detail built-in shader)
  • VertexLit (taking into account the baked vertex lighting)
  • eventually making a “b” version with a bump map (or even parallax bump)

Any idea’s how to do that?
Eager to learn how you guys combine different code from different shaders…
I’m really getting into unity, so much fun !!

Thanks and Best,

Gon

Ok, so the first two points are handled by just using Diffuse Detail shader.

Not sure about “vertex lit” - do you want dynamic vertex lighting, or pre-baked vertex colors? If the vertex is pre-baked then bumpmapped terrain does not make much sense (there are no dynamic lights - so where the light direction should come from for bump mapping?)

Dear Aras,

Yes I mean you got it right, the idea is to have pre-baked vertex lighting values work with the Diffuse detail shader.
The second idea was to include a basic bump to the detail-texture.
So the pre-baked vertex values are not used for the bump but purely the illumination.
Is this any clearer? not sure how to phrase it in code-terms… my bad therefor.

Gon

But you see, you have contradicting stuff: you don’t want dynamic lighting on terrain (illumination is pre-baked), but you do want bump-mapping on the nearby parts.

Bump-mapping often does not make much sense if lighting is pre-computed. First, it needs some light direction to do the bumpmapping calculations (which you don’t have if lighting is precomputed); and then it’s a waste of processing power. If lighting is static, just do a simple detail texture that captures “the bumpyness” under your lighting conditions.

ok i think we can forget the bump…
or
what about letting dynamic lighting be counted-in as well as the vertex lighting?
and then we can let the dyn. lighting do the bump?

i mean otherwise just having the Diffuse Detail Shader be vertex-lit is already great!

Here it is: BakedLightingDetailTexture on Unify wiki. This is quite different from DiffuseDetail or other vertexlit-colored shaders - this one does not respond to lights at all; all illumination is just stored in vertex colors. As I understood, that is what you wanted, right? So the shader is really simple (and fast!).

WAW that’s great, applying it now, new scene up in a few minutes :slight_smile:
Aras you RULE, thanks and best**

Is there a way to add a very basic way to adjust the general brightness (like incandescance in maya i’d say)?
I mean if making it affected by in-scene lighting is not too costly for the gpu, maybe that would even be better as a material for others to use?

cheers up

gon