Author Topic: Shaders, how to make them?  (Read 1289 times)

seems like a real cool feature after I saw megascience's lsd one

I opened the code and it looks like you edit files in the shader directory, mostly the renderVsm_vert.glsl one which contains:
Code: [Select]
void main()
{
// Bricks always in world space.
  worldPos = (obj2World * vec4(gl_Vertex.xyz, 1.0f)).xyz;
  worldNormal = ((obj2World * vec4(gl_Normal.xyz, 0.0f)).xyz);

  if(length(gl_Normal.xyz) < 1.1f)
  worldNormal.xyz = normalize(worldNormal.xyz);

// Do some camera delta math.
viewDelta.xyz = worldPos - camPos;
viewDelta.w   = length(viewDelta.xyz);
viewDelta.xyz = -normalize(viewDelta.xyz);

// Fog can be done per-vertex.
fogCoords.x = clamp((fogConsts.y - viewDelta.w) * fogConsts.x, 0.0f, 1.0f);
fogCoords.y = clamp((worldPos.z - fogConsts.z) * fogConsts.w, 0.0f, 1.0f);

  // Project the brick pos and normal.
vPos = world2Cam * vec4(worldPos, 1.0f);
gl_Position = gl_ProjectionMatrix * vPos;
normal = worldNormal;

// Pass color through.
gl_FrontColor = gl_Color;

// Pass texcoords through.
texCoord = gl_MultiTexCoord0.st;
}

But if you're modifying one file, what if you have two shaders?
What am I missing?
Is there a guide somewhere I missed? (not stickied here, I know that)

Right now, there's no official support for custom shaders. You'll have to edit the existing files, renderCsm_vert, renderCsm_frag, and common to get custom shaders.

Also note that you'll have to use a custom launcher, use an add-on that writes them on startup or set them as read-only for it to work; the launcher will automatically overwrite your changes.

Also note that you'll have to use a custom launcher, use an add-on that writes them on startup or set them as read-only for it to work; the launcher will automatically overwrite your changes.
The shaders reload when you change your shader quality, so you could just do optionsDlg.setShaderQuality($pref::shaderQuality);. Add-ons are loaded after the launcher runs anyways so you don't need to do that if your shader doesn't need a toggle option.

The shaders reload when you change your shader quality, so you could just do optionsDlg.setShaderQuality($pref::shaderQuality);.

Irrelevant.

Add-ons are loaded after the launcher runs anyways so you don't need to do that if your shader doesn't need a toggle option.

What are you trying to say?

Irrelevant.

What are you trying to say?
You can start up blockland, save your shaders and change your shader quality to see them.

You can start up blockland, save your shaders and change your shader quality to see them.

I wouldn't want to manually update my shader files every time I start Blockland.

I wouldn't want to manually update my shader files every time I start Blockland.
You could have an add-on automatically do that, like Tammy's bright point light fix, or make them togglable, like my shaders.

You could have an add-on automatically do that, ...

... use an add-on that writes them on startup ...
... you don't need to do that ...

... you don't need to do that ...

don't know how I missed that