WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-25-2012, 08:12 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Sorry, forgot to mention that you need to convert the matrix to the OpenGL reference frame:
Code:
m = viz.MainView.getMatrix().inverse()
m[2] = -m[2];
m[6] = -m[6];
m[8] = -m[8];
m[9] = -m[9];
m[14] = -m[14];
Reply With Quote
  #2  
Old 09-25-2012, 01:17 PM
leoaered leoaered is offline
Member
 
Join Date: Sep 2012
Posts: 5
Thanks for that, farshizzo. One last question:

How would I tie everything together and add the model matrix to the equation? Do I have to perform any operations/conversions on this matrix as well? Also, what is the multiplication order of model, view, and projection matrices?

<node3d>.getMatrix() on objects doesn't seem to work properly without either an inverse() or the same conversion you used for the view matrix. This seems really weird to me because I manually checked that the transformation matrix was correct as is.

I'm simply trying to send the MVP to the shader, but everything seems to be flipped from what I'm used to. For example, P * V * M seems to be the wrong multiplication order. I also don't understand why you needed to do the conversion on the view matrix.

Thanks again!
Reply With Quote
  #3  
Old 10-01-2012, 02:30 AM
leoaered leoaered is offline
Member
 
Join Date: Sep 2012
Posts: 5
Yikes! I've been debugging for some time and it seems like there's still something wrong with the view matrix.

I made a simple plane and tried rendering it with:
Code:
m = viz.MainView.getMatrix().inverse()
m[2] = -m[2];
m[6] = -m[6];
m[8] = -m[8];
m[9] = -m[9];
m[14] = -m[14];
The plane is rotated! Everything goes back to normal with ftransform().
Attached Files
File Type: txt test.py.txt (930 Bytes, 6159 views)
File Type: txt plane.obj.txt (242 Bytes, 6207 views)
Reply With Quote
  #4  
Old 10-03-2012, 12:42 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Vizard will rotate certain model formats by 90 degrees along the X-axis in order to bring it into the Vizard coordinate frame. This is probably why you see a rotation.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vizard Headlight in Shader shivanangel Vizard 1 06-27-2012 01:19 PM
SSAO Shader Implementation FranciscoPeters Vizard 2 10-08-2011 04:19 AM
How to apply shader and render texture to an object whj Vizard 0 04-23-2010 12:23 PM
Multiple Textures for Diffuse and Specularity Shader Issue shivanangel Vizard 1 05-11-2009 10:44 AM
Specular Shader Issue shivanangel Vizard 2 05-06-2009 11:08 AM


All times are GMT -7. The time now is 10:56 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC