Skip to main content
GameDev.net gamedev.net
🔒 Locked

procedural textures

Started by Majestik666 Dec 8, 2002 at 2:11 PM 0 replies 350+ views
Original Post
Majestik666
Majestik666
i was just asking myself a question about procedural textures, how do you store them to a file, i.e. do you define standard functions in the engine and make a reference to them in the 3d file, or writing a dll specific for the object and store the functions in it ? or any other idea ? thanks
ApochPiQ
ApochPiQ
It depends on how programmable your procedural shader logic is. For example, POVRay''s procedural textures use only a few values (omega, lambda, etc) to control the procedural texturing, while other engines have complete C-like scripts that allow you to define functions:

color texture_map(point pt)
{
color.r = ((pt.x % 10) / 10) * 255;
color.g = abs(cos(pt.y));
if(pt.z > 15)
color.b = 0;
else
color.b = 12;
}


So really how you store the textures depends on how your shaders work. Implementing a simple set of functions and passing parameters to them (such as turbulence functions which call a perlin noise generator) is easiest and often faster than trying to parse a complex script, unless you can distill the script into a simple and easy-to-process bytecode.

Also, if you want to use precedural textures with a scanline engine (eg DirectX) you''re in for some fun trying to get a procedural texture map into texture space so you can map it ;-)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.