hi all, new user here. cannot find in examples even remotely clue where to look. i need to make super simple project where flat laying shape will have shadow on each side of its shape. dependint where is the light source (from left or right) shadow will be dark or light. any pointers? tysm
can you draw a picture of what you mean
just flat ellipse laying down on canvas, as light hits from one point, on that side it will have highlight, on the other dark shadow (as it will have colored background, that will be visible).
Not sure if this is what you’re after, but here’s something that might get you started.
viewer.mode=STANDARD function setup() assert(OrbitViewer, "Please include Cameras as a dependency") scene = craft.scene() scene.sun.active = false scene.sky.active = false v=scene.camera:add(OrbitViewer, vec3(0,3,0), 12, 0, 200) v.rx=20 v.ry=45 local floor = scene:entity() local r = floor:add(craft.renderer, craft.model.cube(vec3(7,.4,7))) r.material = craft.material(asset.builtin.Materials.Standard) r.material.map = readImage(asset.builtin.Blocks.Trunk_White_Top) parameter.number("posX", -7, 7, 0) parameter.number("posY", -7, 7, 4) parameter.number("posZ", -7, 7, 0) parameter.number("Angle", 0.0, 180, 15) parameter.number("Penumbra", 0.0, 60, 60) parameter.number("Intensity", 0.0, 1.0, 1.0) light = scene:entity():add(craft.light, SPOT) light.penumbra = Penumbra light.color = color(255) light.decay = 0 local r = light.entity:add(craft.renderer, craft.model.icosphere(0.1, 2)) r.material = craft.material(asset.builtin.Materials.Basic) end function update(dt) scene:update(dt) light.entity.position=vec3(posX,posY,posZ) light.type = SPOT light.penumbra = Penumbra light.angle = Angle light.intensity = Intensity end function draw() update(DeltaTime) scene:draw() end
@dave1707 - your demo crashed on me, posted code. It fired up an error before, posted error image here.
@Bri_G It runs fine for me as V3. The message its putting out is a reminder to add Cameras as a dependency otherwise it would put out an error message that isn’t as clear.
@dave1707- aaarghhh, my bad. Sorry thought it was V4 code.
interesting! it will be a long learning journey, i see… tnx!