Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (OptimusPrime, AndrewAMD), 14,580 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Manually Creating the View Matrix #281965
07/29/09 17:22
07/29/09 17:22
Joined: Jun 2009
Posts: 5
A
adiumcommodore Offline OP
Newbie
adiumcommodore  Offline OP
Newbie
A

Joined: Jun 2009
Posts: 5
Hi,

With the kind of game I'm developing there's a lot of reorientation of the vertical axis. I'm using a quaternion representation of things but gimbal lock is still a problem.The process of deriving euler angles from the quaternion is the problem. I know that if I were able to directly construct a view matrix using my quaternion that this problem could be resolved.

I've tried manually setting the view matrix when the render_sky event (and the others like it) are fired. Unfortunately this only seemed to break rendering of my player character and not affect the world or sky at all. Is it at all possible to override the engine's view matrix at all?

Any help would be really appreciated, this is the last major technical thing to be tackled before the game's done.

Re: Manually Creating the View Matrix [Re: adiumcommodore] #282035
07/30/09 01:00
07/30/09 01:00
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
ang_to_matrix and ang_for_matrix should help you out (they should be in the next public beta release, which will hopefully be soon). If you want it earlier, that page has an explanation and shows you what the algorithm is, but it's obviously not a quaternion rotation matrix.

When you construct your own quaternion rotation matrix, do you apply it in the shader? If you're making your own worldViewProj matrix you might be trying to render things in the view frustum that normally aren't, which won't work. As long as you are constructing your quaternion rotation matrix correctly, ang_to_matrix and ang_for_matrix should solve your problems.

HOWEVER!!

Also in that update will be ang_for_axis, which will largely make custom quaternion work redundant. You might find having your own quaternion representation useful anyway and use them in conjunction with ang_to/from_matrix.

I have my own quaternion representation that's a few years old now, somewhere in Lite-C Contributions, probably. I was going to resurrect it until I saw ang_for_axis in the upcoming update.

You usually shouldn't base the future of your project on the implementation of futures in a future beta version, but I doubt Conitec would've had trouble with those functions, and a couple of non-public betas have been released afterwards so I assume it's all going well.

I hope this is helpful smile

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Manually Creating the View Matrix [Re: JibbSmart] #282358
07/31/09 13:49
07/31/09 13:49
Joined: Jun 2009
Posts: 5
A
adiumcommodore Offline OP
Newbie
adiumcommodore  Offline OP
Newbie
A

Joined: Jun 2009
Posts: 5
Thanks, those functions look really helpful.

If I understood you correctly the correct way to supply my own view matrix is through the shader for a material? I just thought it might be possible to set it once for everything rather than having to pass a view matrix to ever material rendered in the scene. Additionally to that, how does one pass a view matrix to the default material for the level?

Re: Manually Creating the View Matrix [Re: adiumcommodore] #282426
08/01/09 01:04
08/01/09 01:04
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I don't know of a way to set up your own view matrix. What's it for? A7 already provides standard views with varying arcs, and isometric/orthogonal view modes. If you want to change the viewing angle all you have to do is rotate the view itself, not adjust the matrix.

Unless you have a much different sort of view in mind, I highly recommend playing with the view flags, view.arc, and doing what you can with the view itself (not the view's matrix). Those functions I've mentioned will make it easy to rotate the view's matrix by another matrix, or even just rotate the view with an axis-angle, but sadly that update isn't available just yet frown

The way I mentioned using the shaders was: pass your own matrix in the material.matrix, and use that in the vertex shaders instead of matWorldViewProj. The problem with that is that it doesn't change the view's frustum by which entities may be culled.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1