The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.31 (Linux)
|
shader development - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4) +--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9) +--- Thread: shader development (/showthread.php?tid=1247) |
shader development - NaN - 02-17-2010 I have committed a RenderMonkey workspace with VDrift full shader (no shadows, postprocessing yet). So anyone interested in GLSL shader development(sorry Windows only) checkout immediately! RenderMonkey: http://developer.amd.com/gpu/rendermonkey/Pages/default.aspx Workspace: http://svn.vdrift.net/viewvc.cgi/trunk/tools/win/rendermonkey/?root=VDrift - NaN - 02-17-2010 Playing with the shader I've noticed that the ambient cubemap values can be calculated in the pixel shader. So we can scrap the ambient map and use the sampler for something else(like normalmaps?). cubemap: color=textureCube(tu3_cube,ambientmapdir) quadratic interpolation: y=1-0.5*(ambientmapdir.y-1)^2, color=0.25*y+0.75 linear interpolation: color=0.2*ambientmapdir.y+0.8 I would go for the quadratic interpolation. It comes quite close to the cubemap version. - joevenzon - 02-18-2010 There's probably already room for using another sampler for normal maps. The ambient cubemap gives you different colors and intensities in different directions, which you don't get with an approximation based only on the y coordinate of the normal. If you look at the sides of the tents in your screenshots you can see the difference. I'll grant that it's a very subtle effect, though. If you want to avoid using the texture but match the effect exactly, an approximation with low order spherical harmonics would look almost identical, although it would be more costly than the approximations you proposed. I'm not really against using something else or scrapping the effect, though. I think the final product just has to look good. By the way, if you haven't found it yet, VDrift has a key you can bind to instantly reload the shaders, which is verrry handy while working on shader development. - NaN - 02-19-2010 So the ambient map is actually an irradiance environment map generated from the static environment map? Sorry, I haven't worked with spherical harmonics in graphics yet. :oops: - joevenzon - 02-19-2010 NaN Wrote:So the ambient map is actually an irradiance environment map generated from the static environment map? Yep! That's all done offline though, and really the only reason for it is to try to make the track geometry look less flat, so I'm willing to change it if needed. Spherical harmonics are similar to the way you can build up any function using a sum of simple sine or cosine waves of different frequencies (fourier series) but using a basis function appropriate for a sphere instead of a sine/cosine. Representing an irradiance environment map is fairly easy with spherical harmonics because it's so low frequency: http://graphics.stanford.edu/papers/envmap/ Also, valve uses an "ambient cube" approach which is a little faster (but not as general as spherical harmonics) and easier to understand: http://www.valvesoftware.com/publications/2006/SIGGRAPH06_Course_ShadingInValvesSourceEngine.pdf |