Question regarding light transform using KHR_techniques_webgl and CESIUM_RTC

1. A concise explanation of the problem you’re experiencing.

I am using both KHR_techniques_webgl and CESIUM_RTC for my gltf models.

Here is the way I declare my uniforms in my gltf model

u_light0Transform: {
  semantic: 'CESIUM_RTC_MODELVIEW',
  node: 1,
  type: 35676
},
u_modelViewMatrix: {
  semantic: 'CESIUM_RTC_MODELVIEW', // Model view extension associated to RTC extension
  type: 35676
},
u_normalMatrix: {
  semantic: 'MODELVIEWINVERSETRANSPOSE',
  type: 35676
},
u_projectionMatrix: {
  semantic: 'PROJECTION',
  type: 35676
}....

I used CESIUM_RTC_MODELVIEW in my light transform as it worked fine for me.

However it’s what I thought, it seems that the for the shader for models located in the Southern hemisphere does not work, the light vector in my fragment shader that I get from my transform VS

v_light0Direction = mat3(u_light0Transform) * vec3(0.,0.,1.);

is orthogonal to my normal.

To be honest I started using CESIUM_RTC_MODELVIEW as my lightTransfrom matric, as I noticed it worked, but it’s not something that seems very logical to me.

Would you have any recommendation about the matrix I should be using

Thanks

-Lionel

Hey Lionel,

Is the goal to be able to get the sun’s direction in your custom shader? You might find the shader CesiumJS generates for models a useful reference. Here’s where the light direction is computed: