•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Game Development section within the Software Development category of DaniWeb, a massive community of 401,449 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,919 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 5978 | Replies: 16 | Solved
![]() |
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation:
Rep Power: 5
Solved Threads: 47
it actually only converts a Y to a Z (2D), the value of Z also has to be in terms of the X to be a sphere; to convert them to a spherical system, rho will equal Z, phi will equal Y, and theta will be in terms of Z and X, the sphere co-ordinates and/or mapping to UV depend on the rotation, translation and scale of the sphere at any moment in time.
EDIT: no, rho will equal (distance from sphere to viewing platform) - Z, and phi will equal the distance from the Y origin of the viewing platform to the Y co-ordinate (as clicked on the Canvas)
do you have the java3d demos? look for ..\jdkx.x\j3d\demo\index.html and check out, PickTest and IntersectTest. These methods work by flagging collisions as the graphics are rendering as opposed to calculation positions from current transform3d objects.
Intersect test is quite good, shows picking of points rather than objects.
EDIT: no, rho will equal (distance from sphere to viewing platform) - Z, and phi will equal the distance from the Y origin of the viewing platform to the Y co-ordinate (as clicked on the Canvas)
do you have the java3d demos? look for ..\jdkx.x\j3d\demo\index.html and check out, PickTest and IntersectTest. These methods work by flagging collisions as the graphics are rendering as opposed to calculation positions from current transform3d objects.
Intersect test is quite good, shows picking of points rather than objects.
Last edited by MattEvans : Jul 23rd, 2006 at 10:27 am.
If it only works in Internet Explorer; it doesn't work.
•
•
Join Date: Jul 2006
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
Hi Matt,
Thanks again. We will try to implement the OpenGL document in Java3D.
Assuming that there are no rotation (dx=0; dy=0; dz=0), no translation (dx=0; dy=0; dz=0), no scale (=1.0) at that time, could you please provide the formula for computing U,V?
Terms
See the document: http://www.opengl.org/resources/code...s/node177.html
(This document is written for OpenGL sp it may be easier to implement in JOGL however we prefer Java3D because Java3D code could work in OpenGL and DirectX, meanwhile JOGL code doesn't work in DirectX)
Some terms I don't understand:
1. "The vector from the eye point to the vertex". How to get this in Java3D?
2. "The modelview matrix". How to get this in Java3D?
As always you feedback is much appreciated.
Thanks again. We will try to implement the OpenGL document in Java3D.
Assuming that there are no rotation (dx=0; dy=0; dz=0), no translation (dx=0; dy=0; dz=0), no scale (=1.0) at that time, could you please provide the formula for computing U,V?
Terms
See the document: http://www.opengl.org/resources/code...s/node177.html
(This document is written for OpenGL sp it may be easier to implement in JOGL however we prefer Java3D because Java3D code could work in OpenGL and DirectX, meanwhile JOGL code doesn't work in DirectX)
Some terms I don't understand:
1. "The vector from the eye point to the vertex". How to get this in Java3D?
2. "The modelview matrix". How to get this in Java3D?
As always you feedback is much appreciated.
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation:
Rep Power: 5
Solved Threads: 47
I've attached a new image showing how to get rho,phi and theta values on a sphere; bear in mind these equations have only been tested mentally, so look carefully at the proofings. You may find that some of the axes are expressed upside down, that's a common mistake I make.
You'll notice that there's no longer a Z (distance from viewplatform (eye) to the surface of the circle) in terms of the Y and Z (that is; origin-to-origin displacement Z). It's no longer calculatable by those terms as it was before because the theta value (well, third dimension) affects that distance.
Once you have these; converting them to UV is dependant on your system of mapping UV co-ordinates to rho, phi and theta values. I'm assuming that you derive the UV co-ordinates from rho, phi and theta values, and in that case it'll be easy. I can't tell you how; because UV isn't finite/has no referenceable standard that I know of.
On your sphere, the vector from the eye point to the matrix is the vector from the origin of the camera/viewplatform to a vertex on a shere as it would be if it were a point in global space (so after rotation, scale etc), bear in mind the vertexes location is not the UV co-ordinate.
The modelview matrix is a mixture of the transform matrix * of a model and the transform matrix of the viewplatform/camera/eye. If the object is never moved but the eye is moved, the modelview matrix is the transform matrix of the eye; and if the object is moved and the eye is never moved, it's the INVERTED transform matrix of the object. If both are moved; it's the composite of the camera transform matrix and the inverted model transform matrix. There may be some kind of combine in the Transform3D class, I've never used it, I usually do all parts of 3D transforms separately and build Transform3D's ad-hoc.
* Call getTransform() of a TransformGroup object to access it, but if you're scenegraph/locale is compiled, you'll need to set the ALLOW_TRANSFORM_READ (and probably ALLOW_TRANSFORM_WRITE) capabilities of the transformgroup/object in question.
Looking at the class functions in JBuilder, it'd probably be:
I think I've earnt the right to tactlessly promote my own forum, so check it out: http://www.fusiongroupuk.com. I will post some topics/tutorials about 3D and Java3D there sometime. There'll definately be 3D programs, and maybe some textures and models if I can enlist my lil brother's help
there's not much now though, but check out the demos in the ElementSystem board. It makes me proud :mrgreen:
Good luck, let me know if you have any trouble (especially if you get the equations in and they do something unexpected).
Matt
You'll notice that there's no longer a Z (distance from viewplatform (eye) to the surface of the circle) in terms of the Y and Z (that is; origin-to-origin displacement Z). It's no longer calculatable by those terms as it was before because the theta value (well, third dimension) affects that distance.
Once you have these; converting them to UV is dependant on your system of mapping UV co-ordinates to rho, phi and theta values. I'm assuming that you derive the UV co-ordinates from rho, phi and theta values, and in that case it'll be easy. I can't tell you how; because UV isn't finite/has no referenceable standard that I know of.
On your sphere, the vector from the eye point to the matrix is the vector from the origin of the camera/viewplatform to a vertex on a shere as it would be if it were a point in global space (so after rotation, scale etc), bear in mind the vertexes location is not the UV co-ordinate.
The modelview matrix is a mixture of the transform matrix * of a model and the transform matrix of the viewplatform/camera/eye. If the object is never moved but the eye is moved, the modelview matrix is the transform matrix of the eye; and if the object is moved and the eye is never moved, it's the INVERTED transform matrix of the object. If both are moved; it's the composite of the camera transform matrix and the inverted model transform matrix. There may be some kind of combine in the Transform3D class, I've never used it, I usually do all parts of 3D transforms separately and build Transform3D's ad-hoc.
* Call getTransform() of a TransformGroup object to access it, but if you're scenegraph/locale is compiled, you'll need to set the ALLOW_TRANSFORM_READ (and probably ALLOW_TRANSFORM_WRITE) capabilities of the transformgroup/object in question.
Looking at the class functions in JBuilder, it'd probably be:
Transform3D modelMatrix = new Transform3D(); model.getTransform(modelMatrix); modelMatrix.invert(); Transform3D viewMatrix = new Transform3D(); view.getTransform(viewMatrix); Transform3D modelViewMatrix = new Transform3D(viewMatrix); modelViewMatrix.add(modelMatrix);
I think I've earnt the right to tactlessly promote my own forum, so check it out: http://www.fusiongroupuk.com. I will post some topics/tutorials about 3D and Java3D there sometime. There'll definately be 3D programs, and maybe some textures and models if I can enlist my lil brother's help
there's not much now though, but check out the demos in the ElementSystem board. It makes me proud :mrgreen: Good luck, let me know if you have any trouble (especially if you get the equations in and they do something unexpected).
Matt
Last edited by MattEvans : Jul 24th, 2006 at 7:02 am.
If it only works in Internet Explorer; it doesn't work.
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation:
Rep Power: 5
Solved Threads: 47
there's at least one mistake in the diagram; the line labeled "rho" is actually not rho; you need to calculate the length of that line to work out phi, so rename the line rho on the diagram to the line B.
rho now is equal to the "radius" and is constant for all values that fall on the sphere's surface.
rho now is equal to the "radius" and is constant for all values that fall on the sphere's surface.
Last edited by MattEvans : Jul 24th, 2006 at 8:32 pm. Reason: greek
If it only works in Internet Explorer; it doesn't work.
•
•
Join Date: Jul 2006
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
Hi Matt,
I am terrible sorry that I didn't reply earlier. Indeed you have well earnt the right to tactlessly promote your forum.
Your feedback is a great help. We are now working based on the information you provided and will let you know how we get on with it.
Thanks again,
Martijn
I am terrible sorry that I didn't reply earlier. Indeed you have well earnt the right to tactlessly promote your forum.
Your feedback is a great help. We are now working based on the information you provided and will let you know how we get on with it.
Thanks again,
Martijn
Last edited by 3DStarter : Jul 27th, 2006 at 7:40 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Game Development Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
activex advertising ajax asp blog blogging browser business code console development firefox game games google hardware html innovation intel internet linux marketing microsoft mozilla news nintendo os playstation programming ps3 revenue rss search security software sony stocks video video game vista w3c web web development wii wiki windows xbox 360 xml xp yahoo
- Previous Thread: rectangle in vb
- Next Thread: 7.1 volume control


Linear Mode