Jump to content
Lunarovich

error in function 'SetProjectionMode'.; argument #2 is 'nil'

Recommended Posts

When I try to change a camera mode to Camera.Ortographic, I get a "error in function 'SetProjectionMode'.; argument #2 is 'nil'; 'number' expected."

 

function Script:UpdateWorld()
if (window:KeyHit(Key.Space)) then  
 if (self.entity:GetProjectionMode()==Camera.Orthographic) then
  self.entity:SetProjectionMode(Camera.Perspective)
  self.entity:SetZoom(1)				
 else
  self.entity:SetProjectionMode(Camera.Ortographic)
  self.entity:SetZoom(1)
 end
end
end

Share this post


Link to post

if (self.entity:GetProjectionMode()==Camera.[b]Ortho[/b]graphic) then
  self.entity:SetProjectionMode(Camera.Perspective)
  self.entity:SetZoom(1)							  
 else
  self.entity:SetProjectionMode(Camera.[b]Orto[/b]graphic)

 

i don't know exactly but isn't it the orthographic word that causes trouble ?

Share this post


Link to post

This has been added to the Lua header for the next build. The acual value is 2 for orthographic, 1 for perspective, and 0 for no rendering. Use those until the next build goes out.

Share this post


Link to post

OK. Thanx. Got it and got it working :)

 

A side question: does the orthographic camera render drop shadows? Added point lights with shadows in the FOV of camera but nothing seems to happen...

Share this post


Link to post

I would not expect any shadows to work with othrographic rendering, as it breaks the lighting calculations. Spot and point might, directional definitely will not.

Share this post


Link to post

Yeah, I understand. It would be nice though to have drop shadows with ortographic rendering. In that way we could mimic in 3D good old isometric RPG-s (Fallout, Arcanum, etc). Those had art made in 3D model editors and code done in 2D engines. I gave an ortographic camera (30, 30, 0) rotation and a FOV clamped to 0.5 - 7.5. Than I've implemented some camera controls - global horizontal xz plane movement and modifyable FOV to mimic zoom - to replicate Fallout 1 camera. It's a real bliss :) Missing those shadows though...

Share this post


Link to post

I would just use a camera far away with a high zoom value. It will look about the same as orthographic rendering.

Share this post


Link to post

I've just tried to put camera far away with a high zoom value. There are to problems to the solution:

  1. Directional light drop shadows are not rendered if the camera is too far away. Is there a way to tell camera to render shadows even if its very far from objects?
  2. Vertical lines are not vertical anymore because of the small perspective deformation, so it creates aliased object edges. How do I set higher AA?

Thanks!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...