Loading...
Beta Modpages Unclaimed

Extended Shaders

Adding shader support for mods

0 Likes
253954 Downloads
Created by firemerald

Description

NOTE: The 1.10.2 version is NOT optifine compatible due to the optifine-shadersmod merge in 1.8

Extended Shaders

Shader API for mods!

Extended Shaders is a coremod API that allows forges mod to use shaders, without needing to mess with coremodding and still being compatible with other mods that use shaders via this API.
It allows mods to add shaders and post-processing effects!

You cannot use this API without a good understanding of GLSL, including the GLSL compatibility profile as that is what you will be using.

This mod is Optifine compatible. However, post-processing will ONLY work if "fast render" is OFF.

If Optifine is installed, you can enable shaders by selecting 'Extended Shaders' in the shaderpacks menu. Otherwise, you can turn shaders on/off in the "Video Settings" menu.

this mod REQUIRES your PC support framebuffers, framebuffer blitting, and floating-point textures. It will crash if you do not. This is purposeful.

Readme from GitHub, for modders:

Extended Shaders mod for Minecraft 1.12.2. 
The purpose of this API, and it's containing coremod, Extended Shaders, is to allow mods to use shaders and post-processors inside Minecraft without needing to learn how to make a coremod, and without sacrificing compatibility with other mods using this shader system. 
It is designed to allow multiple mods to "attach" shader uniforms, variables, constants, and code without conflicting with each other, in a way not provided by GLSL itself. 
It is NOT intended to be used by someone without a good understanding of GLSL. 
 
HOW TO USE: 
 
 You will need to add the API classes to your project, PRESERVING the package names. 
 HOW TO MAKE A SHADER: 
  TO MAKE A VERTEX SHADER: 
   1. create a file in your mod's assets, containing a list of the uniforms, variables, and constants, like this: 
    uniform float burnAmount; //uniform 
    varying vec4 fragCol; //variable 
    #define col vec3(.976, .969, .816) //constant 
   2. create a file in your mod's assets, containing the code for the shader, like this: 
    fragCol = fragCol * col; 
   3. create a new ShaderData instance, like this: 
    vertShader = new ShaderData(new ResourceLocation(modid, uniformslocation), new ResourceLocation(modid, codelocation), uniform name 1, uniform name 2, ...); 
   4. to turn it ON, do this: 
    ShaderRegistry.addVertexShader(vertShader); 
   5. to turn it OFF, do this: 
    ShaderRegistry.removeVertexShader(vertShader); 
  TO MAKE A FRAGMENT SHADER: 
   1. create a file in your mod's assets, containing a list of the uniforms, variables, and constants, like this: 
    uniform float burnAmount; //uniform 
    varying vec2 textureCoords; //variable 
    #define col vec3(.976, .969, .816) //constant 
   2. create a file in your mod's assets, containing the code for the shader. you will work via modifying gl_fragData[0], or setting it if you prefer, like this: 
    float depth = sqrt(eyePos.x * eyePos.x + eyePos.y * eyePos.y + eyePos.z * eyePos.z); 
    if (depth > 64.0) discard; 
    depth = clamp(depth / 64.0, 0, 1); 
    float val = (max(max(gl_FragData[0].r, gl_FragData[0].g), gl_FragData[0].b) + min(min(gl_FragData[0].r, gl_FragData[0].g), gl_FragData[0].b)) * .25; 
    gl_FragData[0] = vec4(vec3(1.0) - col * (depth + val - depth * val), gl_FragData[0].a); 
   3. create a new ShaderData instance, like this: 
    fragShader = new ShaderData(new ResourceLocation(modid, uniformslocation), new ResourceLocation(modid, codelocation), uniform name 1, uniform name 2, ...); 
   4. to turn it ON, do this: 
    ShaderRegistry.addFragmentShader(fragShader); 
   5. to turn it OFF, do this: 
    ShaderRegistry.removeFragmentShader(fragShader); 
  PROVIDED UNIFORMS/VARIABLES: 
   check src\main\resources\assets\extendedshaders\shaders\shader_uniform.txt 
 HOW TO MAKE A POST-PROCESSOR: 
  1. create a file in your mod's assets, containing a list of the post-processor's uniforms and constants, like this: 
   uniform float currentTime; //uniform 
   #define rad 3.0 //constant 
  2. create a file in your mod's assets, conatining the post-processor's code, like this: 
   float tx1 = rad * dx; 
   float tx2 = tx1 * .5; 
   float ty = rad * .5 * sqrt(3.0) * dy; 
   vec3 cp1 = texture2D(tex0, texCoords).rgb; 
   vec3 cp1 = texture2D(tex0, texCoords + vec2(tx1, 0)).rgb; 
   vec3 cp3 = texture2D(tex0, texCoords + vec2(tx2, ty)).rgb; 
   vec3 cp4 = texture2D(tex0, texCoords + vec2(-tx2, ty)).rgb; 
   vec3 cp5 = texture2D(tex0, texCoords + vec2(-tx1, 0)).rgb; 
   vec3 cp6 = texture2D(tex0, texCoords + vec2(-tx2, -ty)).rgb; 
   vec3 cp7 = texture2D(tex0, texCoords + vec2(tx2, -ty)).rgb; 
   gl_FragData[0] = vec4((cp1 + cp2 + cp3 + cp4 + cp5 + cp6 + cp7) / 7, 1); 
  3. create a new PostProcessor instance, like this 
   postProcessor = new PostProcessor(new ResourceLocation(modid, uniformslocation), new ResourceLocation(modid, codelocation), uniform name 1, uniform name 2, ...); 
  4. to turn it ON use this: 
   PostProcessorRegistry.addPostProcessor(postProcessor); 
  5. to turn it OFF use this: 
   PostProcessorRegistry.removePostProcessor(postProcessor); 
  PROVIDED UNIFORMS/VARIABLES: check src\main\resources\assets\extendedshaders\shaders\post_processor_frag_uniforms.txt 
 
The API also allows for priorities on shaders and post-processors. Look through the API for more information on these advanced features. 

 


 


AD Become Premium to remove Ads!

What means Verified?

  • Compatibility: The mod should be compatible with the latest version of Minecraft and be clearly labeled with its supported versions.
  • Functionality: The mod should work as advertised and not cause any game-breaking bugs or crashes.
  • Security: The mod should not contain any malicious code or attempts to steal personal information.
  • Performance: The mod should not cause a significant decrease in the game's performance, such as by causing lag or reducing frame rates.
  • Originality: The mod should be original and not a copy of someone else's work.
  • Up-to-date: The mod should be regularly updated to fix bugs, improve performance, and maintain compatibility with the latest version of Minecraft.
  • Support: The mod should have an active developer who provides support and troubleshooting assistance to users.
  • License: The mod should be released under a clear and open source license that allows others to use, modify, and redistribute the code.
  • Documentation: The mod should come with clear and detailed documentation on how to install and use it.

AD Become Premium to remove Ads!

How to Install

1

Download Forge & Java

Download Forge from the offical Site or here. If you dont have Java installed then install it now from here. After Downloading Forge you can run the file with Java.

2

Prepare

Lounch Minecraft and select your Forge istallation as Version this will create a Folder called Mods.

3

Add Mods

Type Win+R and type %appdata% and open the .minecraft Folder. There will you find your Folder called Mods. Place all Mods you want to play in this Folder

4

Enjoy

You are now Ready. Re-start your Game and start Playing.

More Mods like this

Mantle

Shared code for Forge mods

AutoRegLib

A library to ease menial tasks in mod development.

CraftTweaker

CraftTweaker allows modpacks and servers to customize the game. With CraftTweaker you can change recipes, script events, add new commands and even change item properties!

CoFH Core

Contains Core Functionality for all Team CoFH mods. Also does some really cool stuff on its own!

Patchouli

Accessible, Data-Driven, Dependency-Free Documentation for Minecraft Modders and Pack Makers

Baubles

An addon module and API for Thaumcraft