Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Non-square Isometric camera?  (Read 4340 times)
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« on: November 02, 2006, 03:08:58 PM »

I'm having an issue with isometric cameras...
My conception of them is that the form factor of the render target = the form factor of the rendering, i.e. a 512x512 render target will give a 1:1 square rendering. But it seems it's not the case...!



The rendersurface is 512x512, so it's square, and it's associed to an isometric camera that's looking down.
The zoom is inverse-proportional to the landscape size in world units, so that it's supposed to cover the whole of it. But there is a strange gap on the edges... like the form factor isn't 1:1.

Anyone know why this would happen?
Logged

SylvainTV
Administrator
Community Member
*****
Posts: 4971


WWW
« Reply #1 on: November 02, 2006, 04:04:40 PM »

Indeed it's not correct.
I think it takes the width/height of the current viewport, and not the size of the RS. I will try to see what's wrong
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #2 on: November 02, 2006, 06:39:42 PM »

Thanks Sylvain Smiley
For the record...
http://www.truevision3d.com/bugtracker.php?action=view&id=642
Logged

Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #3 on: November 03, 2006, 03:34:40 AM »

Hehe, funny that we always seem to work on similar ideas.

I've been using this technique for a couple of months to render the shoreline water foam. No problems, including with the latest build.

Here's how i set it up:
Code:
[APL operators within brackets]

surfSize=512

surfHeight = #.TV.Scene.CreateRenderSurface 2[rank]surfSize
texHeight camHeight = surfHeight.(GetTexture GetCamera)

camHeight.SetParent #.CONST_TV_NODETYPE.TV_NODETYPE_MESH #.WORLD.iRootMesh 0

camHeight.SetRotation 1.570796371 0 3.141592741

camHeight.SetViewIsometric(600/surfSize) 4000            // fZoom, fFarPlane

camHeight.SetPosition 0 50 0                             // Height only affects clipping (no render behind camera)

shader = #.TV.Scene.CreateShader [null]
{}shader.CreateFromEffectString I43 #._Shader.height

#.OCEAN.sh0.SetEffectParamTexture 'texHeight' texHeight


I suspect that something "disorders" your camera? I checked with the rest of my involved shaders, and they handle the isometric height squarely and linearly.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #4 on: November 03, 2006, 03:15:15 PM »

Like Sylvain mentionned I tried to have a 1:1 factor for the current viewport, and it worked. So looks like isometric cameras created with the TVCameraFactory are dependant on the form factor of the viewport...
Logged

Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #5 on: November 03, 2006, 04:39:59 PM »

So what are you doing that i am not, and why?
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
SylvainTV
Administrator
Community Member
*****
Posts: 4971


WWW
« Reply #6 on: November 03, 2006, 04:41:49 PM »

Yea, I checked the code again, and now I'm sure : it uses the width and height of the current viewport when you actually create the camera.

I wonder what it should be to be correct :p the Width and Height of the current viewport when you use the camera maybe ? But then I would have to recreate the projection matrix each time Smiley
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #7 on: November 03, 2006, 08:26:39 PM »

FYI, I just spoke with Sylvain and this will be fixed in the next DLL.

There's kind of a breaking change associated to it : the "fZoom" of isometric cameras is now the number of world units that are covered, the default being 1x1. If another aspect ratio is needed, the new method SetCustomAspectRatio can set it.

This turned out to be the simplest way because a camera can be associated with many viewports, with many different aspect ratios... And the current isometric camera zoom mechanism wasn't much intuitive.
Logged

Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #8 on: November 04, 2006, 03:56:06 AM »

Quote from: "SylvainTV"
Yea, I checked the code again, and now I'm sure : it uses the width and height of the current viewport when you actually create the camera.

So what *is* the "current viewport" when one executes a surface.GetCamera? As said, this works ok for me.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #9 on: November 04, 2006, 04:09:56 AM »

Quote from: "Zaknafein"
FYI, I just spoke with Sylvain and this will be fixed in the next DLL.

There's kind of a breaking change associated to it : the "fZoom" of isometric cameras is now the number of world units that are covered, the default being 1x1. If another aspect ratio is needed, the new method SetCustomAspectRatio can set it.

This is ok. But why not use two numbers for fZoom then?

Quote from: "Zaknafein"
This turned out to be the simplest way because a camera can be associated with many viewports, with many different aspect ratios... And the current isometric camera zoom mechanism wasn't much intuitive.

True, had to use trial & error to find it out.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #10 on: November 04, 2006, 04:50:17 PM »

Quote from: "Waterman"
This is ok. But why not use two numbers for fZoom then?

Yeah, one or the other. Sylvain decided to put in an aspect ratio, I'm fine with that decision. Tongue

Edit to avoid double-posting : Actually, the aspect ratio does NOT default to 1:1. It defaults to the current viewport's aspect ratio for backward compatibility I guess. So my advice : don't take any chance and set it to what you need in all cases...
Logged

jfberge
Customers
Community Member
*****
Posts: 227


« Reply #11 on: January 22, 2007, 06:36:33 PM »

Thank god I found this thread. This was driving me insane.

I'm still having problems with the new dll, though. I have two windows in my editor, a top-down isometric and a regular first person. I used to be able to switch between the viewports fine, but now the first-person viewport retains the isometric perspective.
Logged

It works on my machine
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #12 on: January 22, 2007, 08:33:33 PM »

Hm, strange. Make sure you create both cameras with TVCameraFactory, I've had similar problems when just new'ing TVCameras.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks