Jump to content

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


Lunarovich
 Share

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

Link to comment
Share on other sites

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 ?

AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11

Link to comment
Share on other sites

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.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...