Jump to content

Recommended Posts

Posted

Normally I use 

mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/blur.json"));

to load a shader however, this puts the shader on the entire screen. How do I apply the blur shader on only a specific part of the screen?

I tried

Field resourceManager = EntityRenderer.class.getDeclaredField(Mapping.resourceManager); /* shaderGroup = isObfuscated() ? "field_147707_" : "shaderGroup"; */
Field shaderGroup = EntityRenderer.class.getDeclaredField(Mapping.shaderGroup); /* resourceManager = isObfuscated() ? "field_147711_ac" : "resourceManager"; */
Field useShader = EntityRenderer.class.getDeclaredField(Mapping.useShader); /* useShader = isObfuscated() ? "field_175083_ad" : "useShader"; */
resourceManager.setAccessible(true);
shaderGroup.setAccessible(true);
useShader.setAccessible(true);

shaderGroup.set(mc.entityRenderer, new ShaderGroup(mc.getTextureManager(), (IResourceManager) resourceManager.get(mc.entityRenderer), mc.getFramebuffer(), new ResourceLocation("shaders/post/blur.json")));

((ShaderGroup) shaderGroup.get(mc.entityRenderer)).createBindFramebuffers(300, 300);

useShader.setBoolean(mc.entityRenderer, true);

However, this shurk my entire screen and applied the blur filter there and resizing the window causes it to reset. Is there any way I am able to only blur the part of the screen I want and not just the entire screen? 

Screenshot 2020-10-25 110746.png

Posted

If I'm not mistaken, there is some way to specify a portion of the screen to apply the shader to in the JSON using an intermediary layer to apply the shader to. As for how, I do not remember. I just remember there being something similar to that when I was doing research about them at the beginning of the month.

Posted
14 hours ago, yoinkityyoinks said:

Is there way to do this in code or do I really need to create custom layers

Once again, I'm unsure. There is probably a way to do it within the program itself. However, it should be preferable to try and find a JSON solution first if possible.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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