Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Brunk

Members
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Brunk's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Here is what I do : In a function that I subscibe to RenderLivingEvent$Pre, I change the value of the uniform in the corresponding shader. @SubscribeEvent public static void renderEntityPre(RenderLivingEvent.Pre event) { ... ECNC_Shader = GameRenderer.getRendertypeEntityCutoutNoCullShader(); // Access to the shader ECNC_Uniform_RenderValue = ECNC_Shader.getUniform("RenderValue"); // Access to the shader uniform ECNC_Uniform_RenderValue.set(1); // Change the uniform value ... } I have modified the vanilla fragment shader "rendertype_entity_cutout_no_cull.fsh" to process the new uniform. ... uniform int RenderValue; ... void main() { ... if(RenderValue == 0) { color.r = 0.0; color.g = 0.0; color.b = 1.0; } ... } I can't give you either the shader or the function used to render blocks, but you can probably find them if you take a look in the vanilla code (that is how I find what I used). Hope it can help you
  2. Hello everyone, Recently I have encoutered a problem with my mod (or maybe the way minecraft work), and after searching for days without any solution, I post here in case any of you can help me. My goal : Change the color of a mob depending on a custom tag. What I have done : Within a function that I have register to the RenderLivingEvent#Pre event, I checked the entity tag and change the value of the corresponding shader's(rendertype_entity_cutout_no_cull) Uniform that I have added (specific value = appeared in flat color). Then in another one registered to RenderLivingEvent#Post, I set back the Uniform to the base value (base value = appeared black and white). The result : it worked, kind of... Case 1 : This is the basic result. Case 1bis : This is the same iteration but I have cleared the zombie item. Case 2 : This is the result when I don't reset the Unifom in the RenderLivingEvent#Post event. Case 3 : This is the base result when I am 16 block away from entities. Case 4 : This is the result when I am 16 block away from entities and I don't reset the Unifom in the RenderLivingEvent#Post event. Some explanation : I spawned the mobs in a specific order so they render in that order (Stray->Skeleton->Zombie->Witch->Blaze). As showed in case 1 and 3, simple entities (without object or layers) are rendered after the RenderLivingEvent#Post event (since I call the uniform in there to make them black and white). If the entity has objects or layers, then the base model is rendered before the Post event and the layers are rendered after (look at the stray an zombie in case 1). From case 2, I assumed that the entity is complitely rendered (base and layers/objects) before the next RenderLivingEvent#Pre. From case 3 and 4, I assumed that rendering change when entities are 16 block away from the player. Here you can see that the entity will finish rendering after the next RenderLivingEvent#Pre. The base model is still rendered before the Post event. My conclusion : The rendering of entities are slightly delayed, permitting the CPU to modified the Uniform before the GPU has finished rendering it. From what I have tested it's not a problem with my code. I don't know if there is a solution to my problem. Thanks in advance for any help ! PS : English is not my mother tongue, so excuse my writing.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.