Sodium Reloaded (Unofficial)

Sodium Reloaded (Unofficial)

0 Downloads

Allow Specifiying Materials for custom RenderLayers

walksanatora opened this issue ยท 6 comments

commented

Request Description

so currently if you put your block on a specific (non-vanilla) render layer it crashes because of a IllegalArgumentException in
https://github.com/CaffeineMC/sodium-fabric/blob/dev/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/terrain/material/DefaultMaterials.java
Please make some way for us to specify our own materials (mabey a interface that has a function)

commented

The default materials which you linked to are not intended to be used by mods. They only exist to map the vanilla render layers (the "defaults") into our own material data.

The Fabric Rendering API allows mods to specify material parameters which can then be used by a renderer (such as Sodium). We don't currently support these APIs, but you can use a compatibility shim like Indium to enable support for it when using Sodium.

commented

so how do you add these materials (since... it kinda lacks documentation)

commented

Sodium is mostly built for Vanilla gameplay. So its difficult to add anymore types of Materials. If its not vanilla friendly.

commented

I don't know where the documentation exists... In theory, you are supposed to be able to specify additional information in your block model's JSON with the material data you want. But I have never actually tested that this functionality exists (or works), because the effort to implement FRAPI has mostly been led by other people.

I will see if there's an example of another mod using it and try to provide that here.

commented

Hm. I figured out why the documentation doesn't exist. It's because the functionality doesn't exist. You cannot specify material data within the block model JSON.

As far as I can see, you would need to register a custom implementation of FabricBakedModel and then specify the material data as you emit the model's mesh back to the renderer.

I asked some people to see if anyone else can shed some light (documentation, examples) on how you can do that.

commented

I should clarify that if you are wanting custom render passes (which each have a set of shaders to render blocks with their given materials), then it likely won't ever be supported in Sodium. The material system is only useful for configuring the shaders which the renderer (such as Sodium) already provides you with. It isn't for specifying custom shaders on your blocks.