#Integrating PSX style rendering into source code.

1 messages · Page 1 of 1 (latest)

lean swift
#

Now this probably seems stupid, and youre probably right, but i was wondering how i might go about changing the renderer in godot so that when it renders 3D objects the vertex positions are rounded instead of floats like the PS1 did. I know theres a bunch of shaders that do this but in order to use it you have to apply them to every single object and that becomes very tedious very fast. I think working in an environment where that's just native to the functioning (for me) would be smoother.

Any ideas how I might go about this?

#

please forgive my naivete, im genuinely curious 🙏

wary light
#

Shaders go inside a material, and you need to apply a material to every object anyway

#

If I was going to modify the engine, I would just add the effect to the standard shader that's built in

#

But that's less flexible than just using shaders normally, and doesn't really save any effort, because again, you do need to assign materials to your meshes anyway

#

Even if you had some kind of importing workflow where you weren't dealing with materials directly, it would be much easier to write an editor script to manage it

grave beacon
# lean swift Now this probably seems stupid, and youre probably right, but i was wondering ho...

If you really do want to change the engine itself:
The standard material shader is generated piecemeal in this file. I only skimmed, so I'm not sure if it's generating GDShader or raw GLSL: https://github.com/godotengine/godot/blob/master/scene/resources/material.cpp.
The vertex function is generated here: https://github.com/godotengine/godot/blob/61598c5c88d95b96811d386cb20d714c35f4c6d7/scene/resources/material.cpp#L1063

#

You can convert a standard material to a shader in engine like so, if you want to see how a whole standard material shader would look:

#

You can also inspect the native GLSL shader code like this:

#

And really, I would recommend not changing the engine and just solving this in userspace. Or maybe wait for this PR, which gives you access to the actual shader templates in userspace instead of with an engine modification: https://github.com/godotengine/godot/pull/94427

GitHub

Custom shader templates is a new feature in the rendering engine that allows you to override the built-in shaders into which user shaders are injected. While the inputs and outputs are fixed, this ...

lean swift
#

Oh nice, I'll just wait then. That custom shader template looks like what I've been waiting for so we'll see where that goes. Thank you for all the information!

grave beacon
#

As far as engine modifications go, it really doesn't seem that complicated - you would be injecting a couple lines at that vertex() function line I pointed out. But it's still not worth it imo