PDA

View Full Version : Metals in glsl and evironment mapping



capedica
04-27-2005, 01:17 AM
Hi,
i'm trying to realize something similiar to a metal surface with environment mapping, i need it to render a car with much realism as possible, naturally results are very poor.
These are some tries:

http://img260.echo.cx/img260/5241/050fz.jpg
http://img260.echo.cx/img260/1528/032ff.jpg

Someone knows how can i improve quality? or where i can find a wonderfull shader (i've already looked in RenderMonkey)?

execom_rt
04-27-2005, 01:20 AM
Did you tried the Cook Torrance shader ?
It's the same shader used in 3DS Max for example.
Looks good. I've have a version for HLSL and GLSL if you are interested.

capedica
04-27-2005, 02:45 AM
sure i'm interested, you can send it to capedica@portalis.it or in this forum, maybe interests to others.
Thank you very much.

execom_rt
04-27-2005, 04:41 AM
I've sent you the shader code in GLSL.

If you have question about this shader, just ask.

For information about BRDF, see here (http://www.cs.wpi.edu/~emmanuel/research/appearance/Bravado/)

capedica
04-27-2005, 05:34 AM
thank you for shader, i've tried but this is result (im trying on a ground, as texture i use one texture and his normal map):
http://img49.echo.cx/img49/2707/prova1la.jpg

do you know what can be the problem?
And another question, if i want use this shader with an anvironment mapping and without texture on it do you know a way?
Thank you

def
04-27-2005, 07:28 AM
For more realistic reflections you would need more dynamic range in the reflection data. A HDR reflectionmap would do nicely.
Check out this page : http://www.debevec.org/

execom_rt
04-28-2005, 12:15 AM
Originally posted by capedica:
thank you for shader, i've tried but this is result (im trying on a ground, as texture i use one texture and his normal map):
Thank youCan you create a screenshot on a 'teapot', in order to verify that is it OK ?

For environment, yes, you need just to create a 3rd (sampler3d s2 in the code) and in the pixel shader:

vec4 TexEnv = texture3D(s2, reflect(L, N));

and write the final gl_FragColor;

(d+s*t.a) * diffuse * t * TexEnv;

In your code, just load the Cube map

WyZ
04-28-2005, 05:11 AM
Hi,

I am also very interested by the shader. Also, I am sure I am not the only one interested. Would it be possible to put it on the web/forum? If not, please email it to me at bedm0203@hotmail.com.

Thanks!

P.S. High Dynamic Range Images (HDR Images) work very well for environment maps. I've been using them for 6 months now. You can convert the RGBE on the fly for each pixel at each frame, or you can convert it to float at load time and use float textures if your hardware supports it.

capedica
04-28-2005, 05:46 AM
I'd like to use HDR environment map, have you got glsl code or something to learn?

execom_rt
04-28-2005, 07:12 AM
Originally posted by capedica:
I'd like to use HDR environment map, have you got glsl code or something to learn? Sample code from nVidia (http://download.developer.nvidia.com/developer/SDK/Individual_Samples/featured_samples.html)

kon
04-28-2005, 07:22 AM
For quite realistic car paints have a look at this pdf:

http://www.ati.com/developer/shaderx/ShaderX2_LayeredCarPaintShader.pdf

WyZ
05-03-2005, 07:03 AM
Hi,

I used the code from Bruce Walter (http://www.graphics.cornell.edu/online/formats/rgbe/) in order to be able to load and convert RGBE images I computed with HDR Shop (http://www.hdrshop.com/) to floating point values. Once I have those values, it is pretty straight forward to convert them to floating point textures. So this is how I am doing it.

Cheers!
WyZ