Material System?

Started by
2 comments, last by AgentC 13 years, 8 months ago
Ive implemented light pre-pass in my game engine, and one of the advantages of this technique is related to better material system implementation or something.

But I dont know what a material system is supposed to be and how light pre-pass makes it better... I guess is for example each material has it own specular power value, but is just this?

For me, light pre-pass is just better because less memory is needed, but I want to know more...

Can you explain me this?

Thanks in advance
Advertisement
Compared to actual forward shading, light prepass is still rather limited. But you can think of all the variations you can use in

1. outputting the G-buffer values in the G-buffer pass
2. interpreting the light accumulation buffer in the material pass

and then abstract them behind some nice interface, and there's your material system. Typically, you'd probably allow a material to define shaders both for the G-buffer pass and the material pass, as well as shader constants & textures used.

Off the top of my head, some of the things you could do:

G-buffer pass:
- normal mapping, detail normal mapping
- G-buffer depth perturbation
- fixed specular power, or specular power from the specular map

Material pass:
- diffuse color & diffuse mapping
- specular color & specular intensity either fixed or from a specular map
- emissive color / enviroment mapping or whatever added on top of the light accumulation result

Also, instead of storing specular power to the spare channel of your normal buffer, you could store a material ID, which you could use to index a lookup texture during the light accumulation. For example, using the lookup texture, you could make N dot L behave in nonstandard ways if desired so.
Quote:Original post by AgentC
Material pass:
- diffuse color & diffuse mapping
- specular color & specular intensity either fixed or from a specular map
- emissive color / enviroment mapping or whatever added on top of the light accumulation result


Thanks for you answer.

Isn't specular color always white?
Isn't specular intensity the specular power?

So in material pass I can also add reflection when Im drawing a mirror or water right?

Also, I guess I should calculate Fresnel term in material pass as well right? And should I recalculate normals or use the normals calculated in G-Buffer?

Just to clarify another thing: Is albedo and diffuse color the same thing?

Well, there are several ways you can interpret the specular channel of the light accumulation buffer. For example:

- output it directly as if it was white light
- modulate by the diffuse accumulated lighting
- modulate with material specular color
- modulate with both diffuse lighting & material specular color
- then there were those kind of weird division tricks Wolfgang Engel wrote about, never tested them personally

Do whatever you find most visually pleasing. I guess there won't be very visually pleasing results if the material diffuse color & specular color differ greatly, though.

I'm not sure if I used correct specular lighting terminology :) But with specular power, I meant the power you raise the specular output to in the light shader, also called shininess I believe, and with specular intensity I meant the simple modulative term you'd use in the material pass, ie. intensity 0.0 = apply no specular, intensity 1.0 = apply full specular

This topic is closed to new replies.

Advertisement