Iris & Oculus Flywheel Compat

Iris & Oculus Flywheel Compat

15M Downloads

Brightly lit contraptions

codegoose opened this issue · 3 comments

commented

Hi there,

I noticed that contraptions are not affected by shader lighting in my server so I went digging around. I added some code to output the results of the vertex shader transformations to the filesystem so I could take a look:

void main() {
  v = FLWCreateVertex();
  vertex(v);
  v.light = vec2(0, 0.85f);
  vec3 skewedNormal = v.normal + vec3(0.5f, 0.5f, 0.5f);
  _flw_tangent = vec4(normalize(skewedNormal - v.normal * dot(skewedNormal, v.normal)).xyz, 1.0f);
  _flw_patched_vertex_pos = FLWVertex(v);
  texCoord = (gl_TextureMatrix[0] * vec4(v.texCoords, 0, 1)).xy;
  vertexColor = v.color.rgb;
  vec3 vertexNormal = fastNormalize(v.normal);
  vec3 vertexTangent = fastNormalize(_flw_tangent.xyz);
  vertexPos = gbufferModelViewInverse * (gl_ModelViewMatrix * inverse(gl_ProjectionMatrix * gl_ModelViewMatrix) * _flw_patched_vertex_pos);
  TBN = mat3(gbufferModelViewInverse) * (gl_NormalMatrix * mat3(vertexTangent, cross(vertexTangent, vertexNormal) * sign(_flw_tangent.w), vertexNormal));
  lmCoord = saturate((vec4(max(v.light, texture3D(uLightVolume, BoxCoord).rg) * 255.0f, 0, 1)).xy * 0.00416667f);
  gl_Position = _flw_patched_vertex_pos;
}

(This is with the Super Duper Vanilla pack.)

I noticed that the ShaderPatcherBase.java is inserting this into Create's passthrough.vert shader:

v = FLWCreateVertex();
vertex(v);
v.light = vec2(0,0.85);

This has the effects of causing the contraptions to be very brightly lit:

2023-11-26_20 11 52

Upon removing the v.light = vec2(0,0.85); line, contraptions go back to normal:

2023-11-26_20 12 10

I'm just wondering what the reasoning behind this is as I don't have full context of what's going on, really.

commented

I have the exact same problem! But I'm a very superficial user( I would be so grateful if you could explain where exactly to find this file, and the document in it, where I can edit this setting and fix the problem.

commented

I have the exact same problem! But I'm a very superficial user( I would be so grateful if you could explain where exactly to find this file, and the document in it, where I can edit this setting and fix the problem.

It's in here:

I had just removed that line and rebuilt the JAR.

commented

Sorry, it was my mistake. I have already fixed this issue in bef9d93.