PDA

View Full Version : Blender, OpenGl, effects & models



DarkShadow44
08-02-2009, 01:21 PM
Hi. ^^
Has someone experiences with blender ?

1) Can you maybe say me how I can disply the UV-Coordinates mirrored ? I think blender save in on the ohter side (the wrong side is textured...)


2)And can you give me a tutorial whow to load a animated model with OpenGl ?

3)Or how I can create dust/fog or an enivironment ?

4)I want to create a model that can be damaged (some parts can be destroyed (the rest should have other textures)), how can I do this ? Do I have to make each part as single object ??

Please help me, I know that it isn't easy ...
:o

todayman
08-02-2009, 02:31 PM
1) Do you mean that the back side of the face, instead of the front? You can either set the other side to be the front (with glFrontFace) or specify the vertices in a different order.

2) There are several ways to animate objects, and this is a very broad area. You should look into skeletal animation, as I think this will work well with objects that have distinct parts.

3) There is built-in fog functionality (section 3.10 of the 2.1 spec), but you could also do it relatively easily in a shader.

4) If parts of the model can be destroyed, then you need to be able to render simply the rest of it, so you would have to have the meshes separated. It seems easiest to me to have a different mesh for each part. In Blender, you could model everything as one, then split up the parts before you export them.

I'm in kind of a rush, so this may not be as clear as it should be...

DarkShadow44
08-02-2009, 03:28 PM
First, thanks for the quick reply.

1) Yes, I importet a model that is perfectly rendered in blender an all the textures were on the wrong side.

What do you mean with "specify the vertices in a different order"? I created the faces new if they were on the wrong side (in blender...)

2) I use Animations with armatures. They are exported into .md3, and then converted in .md2 (because blender has no working .md2 exporter script)

I found an engine (JGE ++), but I causes many problems (problem with setting the view port, double displaes scene, animation/frame limit, etc.), so I want an (easy if possible) code how to load animated and textured models

3) I'am not so experienced with shaders, so I don't know how to create Lights/Shaders, particle effects or fog


4)O.K. but how can I then check for collisions (also with the environment) ?

todayman
08-02-2009, 08:24 PM
1) When you send the vertices to OpenGL, they go there in a certain order. When you start a glBegin(...), the first glVertex(...) call goes first, and so on. When you specify an array, the first vertex in the array is first. When you specifiy a list of indicies, the first index specified is first. If you're using a library, then this is probably hidden from you, and I'm not sure how to fix it.

2) JGE++, at least what I found in ~10 seconds of google, is a 2d engine. Are you writing a 2d program? I don't understand how this engine fits in...

Armatures and skeletons are the same thing. Check out this page that explains, on a low level how this works: Skeletal Animation (http://www.opengl.org/wiki/Skeletal_Animation)

3) Again check out section 3.10 of the 2.1 spec, that defines the fog functionality. Also, see what the online redbooks have to say. There might be tutorials out there. OpenGL is moving more and more towards shaders, so you may want to spend time learning those, though it's not necessary yet.

4) Collisions in 3d are generally handled separately from the graphics. This is another large area. Try google and see what you get. There are several collision detection libraries out there.

Heiko
08-03-2009, 04:41 AM
Hi. ^^
Has someone experiences with blender ?
Yes, I wrote my own exporter to my own file format for Blender once... never finished it completely though and finishing it is still on my todo list.


1) Can you maybe say me how I can disply the UV-Coordinates mirrored ? I think blender save in on the ohter side (the wrong side is textured...)
Not sure about this anymore... you could be right. If it is wrong you just have to apply some transformation (probably a simple transformation matrix would do).


2)And can you give me a tutorial whow to load a animated model with OpenGl ?Never finished that part of my file format... so can't say that much about it.


3)Or how I can create dust/fog or an enivironment ?
Don't know either... never done this in Blender.


4)I want to create a model that can be damaged (some parts can be destroyed (the rest should have other textures)), how can I do this ? Do I have to make each part as single object ??

One of my solutions for a similar problem (wanted to create an object that had several moving parts), I created mesh groups in Blender (not sure how this exactly works in Blender anymore, but you can make groups and name them). I gave these groups a specific name (for example: "destructable_part_<number>") and exported each of them separately in my exporter.



Please help me, I know that it isn't easy ...
:o

Hope this was of some help.

DarkShadow44
08-03-2009, 09:18 AM
JGE++ supports also 3D (for Example Tutorial 9 - 3D Primer) ^^

I want to write an own Class for loading models, because I want to understand/control how this works :)

So I want know how I can load animated + textured models with the texture on the other sides of the faces


And, where can I find the specifications??? I only find VERY short PDFs. :(

Heiko
08-03-2009, 02:57 PM
Did you find the Blender Python api? That is what I used when I was working on my exporter:

http://www.zoo-logique.org/3D.Blender/scripts_python/API/

DarkShadow44
08-03-2009, 03:31 PM
^^ I can export my models, I "only" want know how I can load them.

Or do you mean I should create a new File-Format? ^^
:)

James A.
08-03-2009, 04:24 PM
I made my own exporter for Blender too,

it's not too difficult to make a basic mesh exporter.

the Blender Python API is very useful:
http://www.blender.org/documentation/249PythonDoc/index.html

As is the Blender Artists Forums/Blender forums for scripting help:
http://blenderartists.org/forum/

Heiko
08-04-2009, 12:01 AM
^^ I can export my models, I "only" want know how I can load them.

Or do you mean I should create a new File-Format? ^^
:)

Do you mean loading them in back in Blender? Or do you mean loading them in your own application? In the last case: you know what your file format looks, so you should now which things you can load from your file and what you can do with them. There is no documentation telling you what a file format should be like. If you want to load the model in your own OpenGL application, read the vertices, normals, texture coordinates, colours (and whatever else is in it) from the file. Put the data into buffers (functions: glGenBuffers, glBuffer(sub)Data, glBindBuffer) and render from these buffers. You have to write this code yourself, or start looking for a library that can already do this (but there won't be such a library if you created your own file format).

When creating an exporter and a file format, the best thing to do is thinking about what you want to do with the file in your application. Make your exporter organize the data in such a way that it is ready to use in your application.

If you want to load it back into Blender: use the blender python api (I linked to above) to see how to do it.

I noticed you use JGE++. I have no experience with that, so I can't tell you how to load/render with it. The documentation of JGE++ should be able to tell you that.

DarkShadow44
08-04-2009, 09:18 AM
So, now I've written my first exporter (+ Loader) ^^
I supports only meshes (only Triangles as Faces) with (or without) UV-Textures.

I saves the Models (only single models) as .DEm (DarkEngine Model) ^^

ToDo:
1) Animation Support
2) materials
3) ligth
4) more skinns at once
5) Saving Pictures ^^
...

Mabye someone wants to help me ??

DarkShadow44
08-05-2009, 12:07 PM
Sorry, but I don't know how to edit...

So now it supports animations.