Grid Shader (visual)
Asked Answered
E

6

0

I'n my game, im looking to create an emissive grid shader, unfortunately im pretty new at shaders. I found a tutorial for unity that does pretty much what I want, however Im not finding anything similar to Unitys "Rectangle" node (I'm using visual shaders btw). I have the grid part set up, I'm just struggling to get the edges and a rectangle. Can someone point out what I'm doing wrong and send me in the right direction?

Unity Tutorial -> also what im going for

This is where I'm at now

Esch answered 12/5, 2023 at 19:10 Comment(0)
A
0

Esch Something like this perhaps:

Amitie answered 12/5, 2023 at 20:0 Comment(0)
H
0

Amitie u genius πŸ˜‰

Hygienist answered 12/5, 2023 at 20:4 Comment(0)
E
0

Amitie Thanks thats perfect! Hopefully someday i'll be able to wrap my head around shaders!

Esch answered 12/5, 2023 at 20:37 Comment(0)
A
0

Hygienist u genius πŸ˜‰

Lol, nah! πŸ˜ƒ
Even the simplest of those visual shaders tend to look like rocket science. The excessive box+noodles representation makes it look like something very important and complicated is going on πŸ€“
Imho, working with visuals is quite cumbersome compared to coding it. I mean, this is a couple lines of code shader.

shader_type canvas_item;

uniform float spacing = .05;
uniform vec2 repeat = vec2(5.0, 5.0);

void fragment() {
	vec2 uvt = fract(UV*repeat);
	vec2 mask = vec2(spacing);
	vec2 t = step(uvt, mask) + step(vec2(1.0)-mask, uvt);
	COLOR.rgb = vec3(t.x + t.y);
}

And thinking of it, visual shaders are not really that visual. There's heaps more text in a visual shader than in its coded equivalent. To make things worse, it's scattered all over the screen, in contrast to code where everything flows in sequence.

Amitie answered 12/5, 2023 at 20:49 Comment(0)
E
0

Amitie The code does seem simpler, but I just cant visualize in my head whats going on like I can with normal code. Do you recommend any guides or videos to try and help that?

Esch answered 12/5, 2023 at 21:2 Comment(0)
A
0

Esch I think GDQuest had a gentle introductory video series on shaders in Godot. But I'm not much of a tutorial person. Maybe someone else can give a better recommendation.

Amitie answered 12/5, 2023 at 21:7 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.