Horde3D http://horde3d.org/forums/ |
|
per vertex fog help http://horde3d.org/forums/viewtopic.php?f=2&t=1338 |
Page 1 of 1 |
Author: | anchor [ 19.12.2010, 18:44 ] |
Post subject: | per vertex fog help |
Hello! I'm trying to add per vertex fog into the model shader. But the final color overcomes to white. end of the VS_GENERAL: Code: float _dist = length(vsPos); if ( _dist >= gl_Fog.start ) { fogFactor = clamp( ((_dist-gl_Fog.start)/gl_Fog.end) , 0.0 , 1.0); } else { fogFactor = 0.0; } end of the FS_LIGHTING: Code: gl_FragColor.rgb += ( gl_Fog.color.rgb - gl_FragColor.rgb ) * fogFactor; end of the FS_AMBIENT: Code: gl_FragColor.rgb += ( gl_Fog.color.rgb - gl_FragColor.rgb ) * fogFactor; Note: Exactly same shader approach worked for me in irrlicht. Maybe the light, and the ambient pass added together? If yes, where? Expected result: Actual result: (The fog color ofcourse not white ) |
Author: | phoenix64 [ 19.12.2010, 19:25 ] |
Post subject: | Re: per vertex fog help |
Light passes are rendered additively after the ambient pass, one for every light in the scene. So you probably only want to fade to your fog color in the ambient pass and fade to black in the light pass (= nothing added for lights if you are rendering sth very far away) |
Author: | anchor [ 19.12.2010, 23:13 ] |
Post subject: | Re: per vertex fog help |
Thank You for the help! |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |