The following warnings occurred:
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 94 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "lockoutexpiry" - Line: 573 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 573 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $can_access_moderationqueue - Line: 752 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 752 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $awaitingusers - Line: 34 - File: global.php(959) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(959) : eval()'d code 34 errorHandler->error
/global.php 959 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 1024 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 1024 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5308 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5308 errorHandler->error
/global.php 1024 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1474 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1474 errorHandler->error
/inc/functions.php 1429 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key 1 - Line: 866 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 866 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message
Warning [2] Undefined array key 1 - Line: 885 - File: inc/class_parser.php PHP 8.1.27 (Linux)
File Line Function
/inc/class_parser.php 885 errorHandler->error
/inc/class_parser.php 938 postParser->mycode_parse_post_quotes
[PHP] postParser->mycode_parse_post_quotes_callback1
/inc/class_parser.php 816 preg_replace_callback
/inc/class_parser.php 451 postParser->mycode_parse_quotes
/inc/class_parser.php 201 postParser->parse_mycode
/printthread.php 179 postParser->parse_message



Forums
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).

[Image: rmmkym1.jpg]

So anyone interested in GLSL shader development(sorry Windows only) checkout immediately! Smile
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)
[Image: oldhrta2.jpg]

quadratic interpolation: y=1-0.5*(ambientmapdir.y-1)^2, color=0.25*y+0.75
[Image: paras1uhe.jpg]

linear interpolation: color=0.2*ambientmapdir.y+0.8
[Image: linearqg3yg.jpg]

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