Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / OpenGL Development / Frustum Values on: 2005-07-21 23:05:34
Would like to pose some questions about frustum numbers, if I may.  My models/Levels are coming out of 3dsMax complete with their position in the level (world space). They also have available a geometric center and the farthest vertex from it, which gives me a bounding sphere also with world space values. For this reason, I want to cull against a frustum that is also in world space. I see two ways of implementing Frustum Extraction for this purpose. First is to get the default values and then transform them each frame to compare to the geometry parameters.  Second is to extract them from the Projection and Model-View Matrices each frame and compare.
   In the first implementation, there are several sub-cases. First, I could start with the NDC values and transform them up the pipeline to world space.  This would require reversing the whole pipeline to include viewport transform and perspective division. Second, I could extract them from the initial projection matrix times the model-view (which is identity at this point), which should be in view/clip space. Again, transforming them to world/eye/camera space for culling. Q: Am I correct in equating world/eye/camera space? I feel it is likely since the position of objects in the scene is based on their position relative to the view point/camera.  Third and finally, there is a set of equations (Eric Lengyel’s book Mathematics for Game Programming and Computer Graphics) that allow you to extract the frustum plane values from the parameters passed to either glFrustum or gluPrespective.
   In the second implementation, the literature says that the matrix resulting from the cross product of the projection and the model-view can be used to extract the instantaneous plane values through row multiplication.
   The problem I’m having is that with the exception of implementation 1, case 3 I do not end up with numbers that look like “world” numbers.  From it I get the following with fovy = 45, near clip = 0.1, far clip = 2000, and aspect = 1.333… (1024/768):

   Plane[A:0.15425146 B:0.0 C:-0.9880316 D:0.0]
                    Plane[A:-0.15425146 B:0.0 C:0.9880316 D:0.0]
                    Plane[A:0.0 B:-0.11629547 C:-0.99321467 D:0.0]
                    Plane[A:0.0 B:0.11629547 C:-0.99321467 D:0.0]
                    Plane[A:0.0 B:0.0 C:1.0 D:2000.0]
                    Plane[A:0.0 B:0.0 C:-1.0 D:-0.1]
The other methods yielded values that were 0 or near 1;  even the ones above when transformed with a variety of matrix combinations reverted to similar values. 
   The second implementation yields similar sorts of numbers.
 Q: So how do I get frustum planes that rotate and translate with the view point and will allow culling in world space?
2  Java Game APIs & Engines / Java 3D / Re: Multi-texturing/Multiple Textures on: 2005-04-28 10:34:50
Thanks for the reply.  It's kind of disappointing. Considering that one of the things I've seen that helps with speed is limit the # Shape3Ds.  So it may work the way I expect it to some time in the future when video cards can handle that many textures.  But now no way.
I was getting a lot of slowdown with terrain and a dozen buldings.  Have to get out a ways before fog, etc has a chance of being realistic. Explore all the other ways of cutting overhead.
It does explain the phenomena of the higher indexed texture predominating(FIFO).  Guess it's a pitfall of using a high level of abstraction, that you can fall into the trap of forgetting about the hardware.
Thanks
Jim
3  Java Game APIs & Engines / Java 3D / Re: Multi-texturing/Multiple Textures on: 2005-04-28 01:38:58
I've always been able to do it by breaking up the geometry and creating a Shape3D for each sub-unit but that makes for a lot of Shape3Ds (5-9/shape for simple buildings). When you consider that a Shape3D can have more than one geometry and the texcoordSetMap in each one should be able to select only those textures used in it, it should work.  Also each GeometryArray can have many sets of verts, normals and texture coords; with the texCoordSetMap selecting the TUS(s) for each TCSet.
Surely all this functionality is not there so you can gather all the "Blue Trim" e.g. geometry in one Shape3D.  That is useless and counter productive to things like animation. Read the docs and tutorials on the texCoordSetMap in GeometryArrays and how it's supposed to work. That's the indexing I'm talking about.
4  Java Game APIs & Engines / Java 3D / Multi-texturing/Multiple Textures on: 2005-04-24 10:55:39
Having a lot of problems with both kinds of multi-texturing.  First, the ability to place different textures on differing faces of an object. Second, the ability to place more than one texture on a given face.  Then of course there is doing both at the same time.  
The only way I seem to be able to do this is to split up my geometry and build a separate shape3D for each part with an appearance which hold only those TextureUnitStates that are used in that sub-geometry. This leads to a lot of Shape3D objects.
I tried doing the first type by stacking the verts, normals and texcoords into one geometry array and using the initial vert index (in the texcoord adding method) to point to the starting vert effected.  Then mapping the texcoord sets to TextureUnitStates in the Appearance object holding all the textures for the Shape3D.  This resulted in the highest indexed TUS texture being shown on all faces of the shape.
Alternately, I tried doing a combination by creating one Appearance with all the textures and placing the sub-geometries in their own geometry arrays, which were added to the Shape3D.  The texcoordset to TUS map for a one of these Geometry array would typically look like this:
[code]
Index      Value
0      -1
1      -1
2      0
3      -1
4      -1
5      1
[code]
In this case too the highest indexed TUS texture seemed to predominate.  The docs say that using -1 prevents that TUS from being used in that geometry array.  The map above should be equivalent to using an Appearance with 2 TUS and a map of {0,1}.  Of course this requires more Shape3Ds.
     However, that does not seem to be the case.  If an Appearance object includes TUS not used in a particular sub-geometry then there seems to be some bleed-over.  The highest indexed TUS always predominate.
     Is there a capability bit I'm missing, a Texture/Rendering/etc attribute I'm missing?  I'm using DECAL for the base texture and COMBINE_ADD for the second which is a lightmap.


5  Java Game APIs & Engines / Java 3D / Re: ASE Loader (texture problem) on: 2005-04-13 11:35:29
Is this the kind of multi-texture where you have different single textures on different faces of an object? Or the kind where you put more than one texture on the same face.
If type one, you have to break up the geometry so each sub-shape has one base texture.  If you use TextureUnitStates, you can apply more than one texture to all the faces of this subshape.
Texture unit states is how you add more than one texture to the same face
Jim
6  Java Game APIs & Engines / Java 3D / Re: ASE Loader on: 2005-04-12 12:12:43
Hey looked at some of your source and saw that you in deed had some animation frames.  Did you build those from the data in the ASE file?  Haven't seen this done before and have always been told that ASE doesn't support animation.
Jim
7  Java Game APIs & Engines / Java 3D / Re: Branchgroup RemoveChild on: 2005-04-12 12:01:40
The capability ALLOW_DETACH is only available in branchgroup.  Drop children only if ALLOW_CHILDREN_WRITE is set. Then set it to null in the branchgroup.
If you want a detachable leaf hang it off a branchgroup which can be detached.
8  Discussions / General Discussions / SceneGraphObjects aquiring parents without add on: 2005-04-12 11:46:49
Has anyone else encountered a situation where upon adding a newly constructed SceneGraphObject you get the "Multiple parent exception"?
First ran into this when constructing an array of Shape3Ds in a class designed to handle the data for a single model. When I used a 'for' loop to iteratively add the shape3ds to a transform group I got the error on the first addChild. The parent (using getParent()) was a TranformGroup. I solved this by having my model class only supply the GeometryArray and Appearance and building the shape3ds in the 'for' loop at attachment.
Now I am encountering the same problem with Backgrounds, with no convienent work-around.
Jim
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Elsealabs (11 views)
2014-12-28 10:39:27

CopyableCougar4 (17 views)
2014-12-28 02:10:29

BurntPizza (21 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (94 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!