Porting shaders from shadertoy.
Asked Answered
F

1

0

Hello.
Most of the shaders from shader toy work, once the main method is replaced with
void fragment(){
vec2 fragCoord = FRAGCOORD.xy;
ve2 iResolution = 1.0 / SCREEN_SIZE_PIXELS
float iTime = TIME.

However, the shader draws on canvas in screen space. How do I convert the above code to draw in the specific's node bounds?

How do you generate a random number in a shader code? do you create a noise texture, and subtract (or add) sin(TIME) to it?

Does godot shading language allow to sample 3d textures? a number of explosion shaders on shader toy do that.

Favata answered 2/2, 2023 at 18:44 Comment(0)
E
0

Favata How do I convert the above code to draw in the specific's node bounds?

Use nodes UV instead of screen coordinates?

Favata How do you generate a random number in a shader code? do you create a noise texture, and subtract (or add) sin(TIME) to it?

Used to, yeah. But there's also a OpenSimplex implementation within the engine these days, that's probably more convenient to use.

Favata Does godot shading language allow to sample 3d textures? a number of explosion shaders on shader toy do that.

I mean, would there be any point to having a shader language and support for custom shaders and then not be able to do those things?

Elamite answered 2/2, 2023 at 18:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.