How can I pixelate a shader with an already altered UV? (Visual Shader)

Godot Version

Godot 4.3

Question

I’m working on a shader for procedural low-poly, PSX/Minecraft texture quality, gas giant planets. I also decided to go the visual shader editor route since I thought it would be more manageable as someone with a visual arts background (I am pretty new to shader coding).
The shader is almost done, it’s got fully functional flow-maps, noise displacement and gradient mapping, everything you need for a high resolution procedural gas giant. The last step is to pixelate it, and here’s where I’m completely stuck!

I’ve got a very basic pixelation graph that works just fine when plugged into the UV port of an unaltered Texture2D node, however it doesn’t act nice at all when I try to merge it together with the procedural planet part of the graph. I’ve tried combining it at multiple different stages of the graph in various ways and none of them lead to a pixelated result. A second pass won’t help either since it can’t read the output from the previous pass. I’ve looked everywhere for a solution but I can’t find any, texture pixelation tutorials do not brings up what to do if the uv node to the texture is already occupied.

There must be something that I don’t know about that I can do to fix this, does anyone know what that is? Or what I could try to fix it?
Is it because I’m using a visual shader instead of a code-based shader? Is it limiting what I can do here?

Update: I almost solved it using what I think is a hacky solution, which involved moving all the shader graphs to a 2D color rect inside, and then pixelating a viewport texture of said color rect in the sphere shader code.

Godot_v4.3-stable_win64_TBDWV1EQeY

It spat out a lot of errors but after making all the shaders in the gas giant scene local it’s getting closer to working. Just have to figure out why it render incorrectly when running ingame…

I’m still interested to know if there’s a better solution for pixelating a proc gen shader.

1 Like

Have you tried using a very small noise texture?

I’ve tried it. it doesn’t appear to make any difference, at least not with the built in godot noise.

You can code your own noise visual shader plugins: Visual Shader plugins — Godot Engine (stable) documentation in English You might also be able to use this technique to code other helpful nodes for yourself. Maybe solve the problem a different way? I haven’t played with this much yet, but I did like being able to tweak my noise with uniforms.