Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Fog Enabled Problem

in Bugs Posts: 80

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 :)

Comments

  • Posts: 2,355

    @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)
    
  • dave1707dave1707 Mod
    Posts: 9,418

    @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??

  • dave1707dave1707 Mod
    Posts: 9,418

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

  • dave1707dave1707 Mod
    Posts: 9,418

    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
    
Sign In or Register to comment.