0 votes

I want to combine:
https://ibb.co/gZGVtKh and https://ibb.co/XXYVzPs to obtain: https://ibb.co/FVWWGgb

basically where the white in the radial gradient is, the voronoi shader's form needs to be seen. Can I do that in Godot? I have the code for both shaders, I just don't know how I can combine them .

Godot version 3.2.2
in Engine by (92 points)

You need to use the radial gradient as a mask for the voronoi. So by multiplying the result of the radial gradient to the voronoi, you should get only the voronoi where your gradient is.

1 Answer

0 votes

Shader Combinations

Create a function for both of your shaders and return the output then as MrEliptik stated multiply the results

Example

vec3 radial_gradient(){
    return output
}

vec3 voronoi(){
    #your code here
    return output
}

void fragment(){
    COLOR = voronoi() * radial_gradient()
}

Tips

  • The output var is what you would normally have in your fragment function as ABEDO = output or COLOR = output

  • If multiply gives you unusual results try also multiplying by a fraction or adding instead

  • If you're familiar with Visual Shaders this actually gets done for you automatically and the added bonus of seeing it live to make tweaks

by (4,168 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.