Jump to content

( LUA ) SetShadowMapSize()


Go to solution Solved by Josh,

Recommended Posts

Posted

I dont think this command is preforming it's duties..

I can set it to :  SetShadowmapSize(0)

or

I can set it to : SetShadowmapSize(2048)

And get the same results.

Does this work on DirectionalLights? 

If not where is the SetShadowQuality() command?  Theres got to be some way to control the overall Qulity in code>? The editors Shadow Quality setting DOES NOT carry over to map/scene files.

 

 

  • Solution
Posted

World:SetShadowQuality was not exposed to Lua. I apologize for this oversight and I am adding it now.

Here is an example showing the Light:SetShadowmapSize in action:
 

--Get the displays
local displays = GetDisplays()

--Create a window
local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR)

--Create a framebuffer
local framebuffer = CreateFramebuffer(window)

--Create a world
local world = CreateWorld()

--Create a camera
local camera = CreateCamera(world)
camera:SetClearColor(0.125)
camera:SetFov(70)
camera:Move(1, 1, 3)
camera:Turn(90,0,0)

--Create light
local light = CreateSpotLight(world)
light:SetPosition(0,1,0)
light:SetColor(2)
light:SetRange(0.01,20)

local box = CreateBox(world)
box:SetPosition(0,0.5,2)

--Create ground
local ground = CreateBox(world, 20, 1, 20)
ground:SetPosition(0, -0.5, 0)
ground:SetColor(0, 1, 0)

q = 1

--Main loop
while window:Closed() == false and window:KeyHit(KEY_ESCAPE) == false do

    if window:KeyHit(KEY_UP) then q = q + 1 end
    if window:KeyHit(KEY_DOWN) then q = q + 1 end
    if window:KeyHit(KEY_SPACE) then light:SetShadowmapSize(64) end
    --world:SetShadowQuality(q)

    world:Update()
    world:Render(framebuffer)
end

 

  • Like 1

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...