View previous topic :: View next topic |
Author |
Message |
John DeleD PRO user
Joined: 22 Dec 2008 Posts: 182 Location: Houston, TX
|
Posted: Thu May 19, 2011 3:32 pm Post subject: dxs file format specification? |
|
|
I've been looking at the DXS format with the intent of making a parser for it (no particular reason yet, I'm trying to relearn my c++ skills). I've been looking for a format specification for DXS on the website but can't find one. The format is pretty easy to understand but I could get the work done faster if there was a specification for it. Is there any such document? |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Thu May 19, 2011 3:53 pm Post subject: |
|
|
Nope, I'm afraid not. Reason is like you said, the format is self-explanatory (or at least, it should be). But if you need to know something, just yell. _________________ Check out Figuro, our online 3D app! More powerful 3D tools for free. |
|
Back to top |
|
|
John DeleD PRO user
Joined: 22 Dec 2008 Posts: 182 Location: Houston, TX
|
Posted: Wed May 25, 2011 9:40 pm Post subject: |
|
|
Well I have put together a program so far that reads the geometry (I'm not doing animations yet though).
Only thing is that each vertex can have more than one UV in DXS which I will try to work around. I'm not quite sure how to load that into a vertex array or VBO.
I'm going to *try* to make an OpenGL screen saver that will show off the DXS models in a set directory. No promises though since I made a C in linear algebra. :/ |
|
Back to top |
|
|
Starnick DeleD PRO user
Joined: 28 Jul 2007 Posts: 611
|
Posted: Wed May 25, 2011 11:59 pm Post subject: |
|
|
John wrote: |
Well I have put together a program so far that reads the geometry (I'm not doing animations yet though).
Only thing is that each vertex can have more than one UV in DXS which I will try to work around. I'm not quite sure how to load that into a vertex array or VBO.
I'm going to *try* to make an OpenGL screen saver that will show off the DXS models in a set directory. No promises though since I made a C in linear algebra. :/ |
Yeah, several vertices may share the same position but have different UV coords (or normals, and other attributes). So each vertex has to be treated as a unique vertex., which of course leads to duplicated vertices, position-wise. There's also the case where you don't need to duplicate the vertex (what if we have two polys referencing the same vertex ID but both have the same UV coords?). If you just naively import the model and read in each vertex listed for each polygon and store each as a unique vertex, then you may be wasting space.
In my own code, I tend to use indexed geometry a lot. So after I import a model and I'm compiling it into its runtime representation, I only pick every unique vertex to be added to the vertex buffer, and for each real duplicate I create an index for it for the index buffer. And when I mean unique, I mean really unique - position, UV, and normal (my importer has several normal generation options - crease, average, etc).
If it helps, you can take a look at the DXS parser I have included with Tesla Engine, which may give an idea of how I go about it. Pertinent classes to look at are DxsParser.cs and DxsMesh.cs. Unfortunately I cant' help much with the OGL part or VBO's |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Thu May 26, 2011 10:23 am Post subject: |
|
|
John wrote: |
I'm going to *try* to make an OpenGL screen saver that will show off the DXS models in a set directory. No promises though since I made a C in linear algebra. :/ |
I'm not worried. Did you know I absolutely s*ck at math? Yet I was able to produce the 3d editing stuff in DeleD by pure perseverance. I am sure you can do the same. Commitment is more important than talent, I believe. Go for it! _________________ Check out Figuro, our online 3D app! More powerful 3D tools for free. |
|
Back to top |
|
|
John DeleD PRO user
Joined: 22 Dec 2008 Posts: 182 Location: Houston, TX
|
Posted: Wed Jun 01, 2011 5:06 pm Post subject: |
|
|
Thanks for having faith Jeroen. After spending a few days parsing and one week figuring out the basics of OpenGL, here is a screen shot from my model loader for DXS...
http://i295.photobucket.com/albums/mm151/coffeeaddict21/deledplusopengl.png
Some limitations so far...
1. Mesh has to be triangulated to load.
2. No textures yet.
3. No smoothing groups yet (breaking apart the primitives is the current work around).
The performance is kind of miserable. Probably because my algorithm for calculating vertex normals is a bit sloppy since I don't really know what I'm doing. That and I'm using vertex arrays which load into RAM rather than video card memory like VBOs do.
I'm going to continue working on it. Send me a message if you want to look at the code. |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Wed Jun 01, 2011 8:23 pm Post subject: |
|
|
Excellent start there, John, I knew you could do it. Now it's all about continuing your work and improve on it. All you need is enough time to commit to it, and the sky is the limit.
Keep us posted about your progress! _________________ Check out Figuro, our online 3D app! More powerful 3D tools for free. |
|
Back to top |
|
|
John DeleD PRO user
Joined: 22 Dec 2008 Posts: 182 Location: Houston, TX
|
Posted: Sat Jun 04, 2011 1:38 pm Post subject: |
|
|
I'm at little confused about the XML for spotlights:
Code: |
<light id="6" type="spot" name="spotlight6" visible="true" range="1000" active="true" castShadows="true" snap="false" intensity="100">
<diffuse r="255" g="255" b="255" />
<specular r="255" g="255" b="255" />
<position x="-4" y="246.923" z="-6" />
<direction x="0" y="-1" z="-5.421011E-20" />
<attenuation constant="1" linear="0" quadratic="0" />
<cone inner="30" outer="40" falloff="1" />
</light>
|
In OpenGL you can specify diffuse, specular, position, direction, attenuation factors, cutoff angle, and the exponent for a spotlight. What I don't see here is the cutoff angle and the spotlight exponent. Are the outer and inner cones angles for two spotlights, nested inside one another? What does falloff mean? |
|
Back to top |
|
|
CableGuy Member
Joined: 11 Jan 2011 Posts: 14
|
Posted: Sat Jun 04, 2011 1:54 pm Post subject: |
|
|
My guess is that the cone has 3 areas: The inner cone has an angle of 30 degrees and inside this area object are completely illuminated. Then you have the area from 30 degrees to 40 in which the light has a constant attenuation with a factor of "1" (from the falloff attribute) and objects outside of the outer cone are not affected by this light.
Translating it to OpenGL, my guess would be that the exponent would be the intensity parameter and the attenuation factors are taken from the falloff attribute ant the attenuation tag.
Hope this makes sense and is not completely wrong as this is my first post in this board, so Hi. |
|
Back to top |
|
|
John DeleD PRO user
Joined: 22 Dec 2008 Posts: 182 Location: Houston, TX
|
Posted: Wed Jun 08, 2011 3:18 pm Post subject: |
|
|
^Yeah. I'm going to be experimenting with that for a while.
I have decided to stop using the depreciated traditional fixed function OpenGL graphics pipeline and do a rewrite using shaders. The OpenGL Super Bible 5th Edition does a pretty good job of explaining it. The big reason I switched is that the lighting that the old pipeline uses just sucks. If things work out I should have something put together in a few days. |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Wed Jun 08, 2011 7:31 pm Post subject: |
|
|
John, have you considered using OpenTK? Don't know if it does the job for you, but it sure looks like a mighty fine library to me. _________________ Check out Figuro, our online 3D app! More powerful 3D tools for free. |
|
Back to top |
|
|
John DeleD PRO user
Joined: 22 Dec 2008 Posts: 182 Location: Houston, TX
|
Posted: Mon Jun 20, 2011 6:37 pm Post subject: |
|
|
^Maybe I will move to that once I finish learning the OpenGL end. I don't want to split my attention between the two interfaces. A chimpanzee could code in GLUT so that is what I am using for now.
A little progress, to show I haven't given up...so far I have a fully lit hand made cube (w/ real time calculated vertex normals) using a vertex light directional shader. I've got it set up to load the geometry from a vector object (with the vertex data interleaved) straight into a VBO so there won't be much of a leap from a cube to a full size model. Blending two texture layers with vertex colors is next. Then I move on to per pixel lighting...and then I'll start testing full size models. As usual, the project is becoming much more intricate then I anticipated, but I am enjoying it. |
|
Back to top |
|
|
|