Answer the question
In order to leave comments, you need to log in
How to embed Math.Random in webgl?
There is such a script on webgl https://codepen.io/Khangeldy/pen/pgXNMZ
How to make variable values random?
Answer the question
In order to leave comments, you need to log in
There is no standard rand function in glsl at our disposal. There is a popular implementation:
float rand(vec2 seed) {
return fract(sin(dot(seed, vec2(12.9898,78.233))) * 43758.5453123);
}
var tuniform = {
SEA_SPEED: {
type: 'f',
value: Math.random() * 10.0
},
time: {
// ...
// Вместо
// const float SEA_SPEED = 0.8;
// используем
uniform float SEA_SPEED;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question