View Full Version : generating a random number in shader
Is there a way to generate a random number in glsl?
I need to generate sample directions.
12-08-2006, 01:47 AM
No, there are functions that generate pseud-random values but these are not implemented on NVIDIA.
What people usually do is to use a texture with random values. That is of course limited to fragment shader on older hardware.
12-08-2006, 02:10 AM
With G80, you can use integer operations in the shaders and therefore, implement random number generators from lets say Numerical Recipes. Using the vertex or primitive id also gives you a seed value.
12-08-2006, 01:47 PM
Using the vertex or primitive id also gives you a seed value.Wait, primitives have ID's now (on G80's)? What extension opens that up?
12-08-2006, 02:00 PM
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.