Fog Enabled Problem

So in my 3D project, I used “scene.fogEnabled = true” and I did near param, far param and fog color. But when I press play, it comes up saying that it failed to compile the shader, and not only that but there a ton of warnings and errors. Is this intentionally have I done something wrong in my code??

Thanks in advance :slight_smile:

@Creator27 - bit more detail and possibly section of code might help.

@Bri_G, this is the code that I’m talking about:

scene.fogEnabled = true
scene.fogNear = 50
scene.fogFar = 10
scene.fogColor = color(255)

@Creator27 Do you have code similar to this in your project. This causes the error. Why, I don’t know.

    c1:add(craft.shape.model,c1.model)
    c1.material = craft.material(asset.builtin.Materials.Standard)
    c1.material.map = readImage(asset.builtin.Blocks.Trunk_White_Top)

@dave1707, yes that’s exactly the code that I have. Is there anyway to fix this issue??

@Creator27 I don’t know why it’s happening. Maybe @Simeon knows what’s happening.

Here’s an example showing the error.

function setup()
    assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
    scene = craft.scene()
    
    scene.fogEnabled = true
    scene.fogNear = 50
    scene.fogFar = 10
    scene.fogColor = color(255)

    v=scene.camera:add(OrbitViewer, vec3(0,0,0), 100, 0, 200)
    createRect()
end

function draw()
    update(DeltaTime)
    scene:draw() 
end

function update(dt)
    scene:update(dt)
end

function createRect() 
    c1=scene:entity()
    w=c1:add(craft.rigidbody,STATIC)
    c1.position=vec3(0,0,0)
    c1.model = craft.model.cube(vec3(10,10,10))
    c1:add(craft.shape.model,c1.model)
    c1.material = craft.material(asset.builtin.Materials.Standard)
    c1.material.map = readImage(asset.builtin.Blocks.Trunk_White_Top)
end