• Blurring the line between real and virtual motorsports
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

lightAmbient in your shader?

Discussion in 'Racer' started by FiftyOrange, Jan 10, 2010.

  1. A bug that's bothering me a bit.

    All my downloads of Racer, from 085 onwards, have the same dyn_standard_reflect_f CG shader, but Tiberius has one which apparently is different fom mine, even though it'scome from the same file downloaded from the same site. So I'm curious if I'm the only one with this different version of the shader, or if it's more common.

    So, if you would, check your data/renderer/shaders_HDR/dyn_standard_reflect_f.cg file (in Note Pad or something similar) and see if you have lightAmbient[/i] at the end of the line that looks like this:

    // Get sky gradient color

  2. Yupp, it's there in line 55. Running 0881.
  3. That should have been added with 0.8.7 and up. I think atmosphere.cg still needs some tweaking to incorporate it properly, but it makes sense for it to be in that line (and in future shaders using that function).
  4. Yep, as Fifty says the shader is working over here on two of our computers and different versions of Racer but he's getting a crash and Qlog error.

    The shader is for chrome, basically it's just the dyn_standard_reflect_f shader but with the fresnel blending removed so that it looks more reflective.

    Here's the code from the shader, if someone can test it and let us know whether it works for them, or not. Just use it in place of the dyn_standard_reflect_f shader, with dyn_standard_reflect_v:

    // Standard with reflection cubemap
    #include \\"atmosphere.cg\\"
    #include \\"lighting.cg\\"
    //#include \\"fresnel.cg\\"
    // Vertex to pixel shader structure
    struct v2p
      float  extinction     : COLOR;
      float2 tc0            : TEXCOORD0;
      float3 Direction      : TEXCOORD1;
      float4 RayleighColor  : TEXCOORD2;
      float4 MieColor       : TEXCOORD3;
      float3 Position       : TEXCOORD4;    // For fragment shader
      float3 normal         : TEXCOORD5;
      // Fresnel in pixel shader
      float3 I              : TEXCOORD6;
      //float  fresnel        : TEXCOORD6;
      float3 R              : TEXCOORD7;    // Reflection vector
    void main(
      // In
      in v2p IN,
      // Out
      out float4 outColor : COLOR,
      // Constants
      uniform sampler2D   baseMap : TEXUNIT0,
      uniform samplerCUBE envMap  : TEXUNIT1,
      uniform float3    lightDirection,
      uniform float3    lightColor,
      uniform float3    lightAmbient,
      uniform float3    eyePosW,
      uniform float     atmosRayleigh,
      uniform float     atmosMie,
      uniform float3    Ke,
      uniform float3    Ka,
      uniform float3    Kd,
      uniform float3    Ks,
      uniform float     Kr,
      uniform float3    shininess,
      uniform float     exposure
      float3 skyColor;
      float3 N=normalize(IN.normal);
      // Get sky gradient color
      // Get base texture color
      float4 baseCol=tex2D(baseMap,IN.tc0);
      // Reflection
      //const float Kr=0.5f;
      float4 envColor=texCUBE(envMap,IN.R);
      // Lighting
      float3 ambient,diffuse,specular;
        // Add reflection
      // Mix sky with texture color based on atmospheric influence
      // Blending
  5. Bruce, it's my computer. ..?

    Completely new unpack of Racer 088.1 to my new and old computers, exact same copy of the Jag + shader, old computer works, new one doesn't.

    Stereo, good call, I've only got 088, 086, and 085, and I wasn't sure which ones had it and which didn't.
    I'm only simple!