Jump to content
  • Advertisement
Sign in to follow this  
Krox

OpenGL Cinema 4D meets OpenGL

This topic is 4234 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi I'm currently programming a graphics engine for some 3D-Roleplaying game (if it gets so far^^). At the Moment there is just a Cube, which you can move over the ground like the a character or something... but now its time to involve the graphics-person, I'm making stuff with (he has no clue of programming, but is a great artist in Cinema 4D), so I've just written an export script in "COFFEE" (the scripting Langauge of Cinema 4D), so we can use our own 3D-Model format. Nothing special so far and it seems very well working so far. But now he told me, that in C4D, he can have multiple Materials/Textures on one Object. Either on distinct parts of it or even overlapping... well i've no Idea how to do that, cause my plan was to use the following structures to descripe a model: Vertex: 3 coordinates for position (x,y,z) + 2 for the texture (u,v) Face: just 3 or 4 links (pointer oder indices or whatever) to vertexes Model: list of vertexes + list of faces + ONE texture (+ addition settings like reflection, transparency and so on..) well... someone a hint for me? thanks Krox ps: As you might guessed, I'm not a native speaker... so excuse my mistakes *g*

Share this post


Link to post
Share on other sites
Advertisement
Your structure, as you said, is just fine for a model with one continuous texture mapped over it. For a more complex model with various materials/textures and possibly overlapping textures, you need :

Model : list of 3D vertices, list of 2D texture coordinates, list of 3D vector normals, list of faces (3,4 or N-gon)
For each polygon going through N points
for each point of the polygon
1 pointer to a vertex
m pointers to 2D texture coordinates (u,v) where m is the number of textures overlapping on this polygon
1 pointer to a normal vector
m pointers to the textures

Consider 2 adjacent faces with different textures, the texture and texture coordinates at their common vertices will be different. If the texture is continuous along the border between the 2 faces, the texture coordinate pointers will simply point to the same texture coordinates.
Similarly, if the edge between the 2 faces must be seen sharp, the normals at the common points will be different, and each face must point to a different normal at the common vertices. If the surface is smooth, they will point to the same normal.

Share this post


Link to post
Share on other sites
sounds complicated.... but accomplishable. Thanks so far, but another question came up: In Cinema 4D you can have a so called "relief texture" in addition to the normal texture (but both in one material). From the relief texture only the brightness matters and determinates how "deep" the real texture is. Any Idea how to render such effekt with OpenGL?

Share this post


Link to post
Share on other sites
I suppose you're talking about bumpmapping. To implement bumpmapping with openGL, you have to write a shader program (it's not possible with the fixed pipeline commands). Look for a tutorial on bumpmapping and GLSL.

Share this post


Link to post
Share on other sites
yeah, thats it. One time more, just a german-english translation problem *g*... thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!