Solved

OpenGL to POVRAY

Posted on 2004-09-18
4
825 Views
Last Modified: 2013-12-26

In response to a question entitled
"Not 3D game.. but 3D rendering"

spilocke at

http://www.experts-exchange.com/Programming/Game_Development/3D_Programming/Q_20137052.html

said
"
Well, what I am trying to say here is I can see 2 clear parts to your program.
1. The modeller
2. The renderer

You can use OpenGL for the interactive modelling part. The user will be able to
place chairs, cups and tables in the virtual 3D environment. You get to see your
house with texture and shadows but the renderings produced are not accurate and
game like. You can stop here if you want to. But if you want to further on, then
just grab the info produced by OpenGL, translate it to Povray format and pass it
to povray to render it out. Here you get a nice accurate shadows, textures,
reflections and other stuffs.
"

I have a somewhat similar problem. I want to quickly place objects in 3D space (the openGL part), but then get a photorealistic version via Povray.

What I don't understand is
"just grab the info produced by OpenGL, translate it to Povray format and pass it
to povray to render it out"

What is "the info produced by OpenGL", how do I "just grab it" and how do I "translate it to Povray format".?????

I assume that the process does not involve translating a zillion calls to glVertex?


0
Comment
Question by:Mutley2003
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
davebytes earned 500 total points
ID: 12096239
I don't know the POVRAY format(s) myself, though I seem to recall an ASCII text file with the raw scene data.

Basically, I'd suggest you'd want to be using vertex arrays, not display lists or immediate mode calls (like no glVertex).  That way, all of your souce modelling data is stored in YOUR own data structures in a form ready to be written out easily -- though in theory, you could have your data 'well organized', but still use immediate mode (glVertex) calls to render things, just slower... ;)

However, I'd start asking questions like:
- why are you writing this
- who is your target audience
- what quality level of output are you looking for
- do you need ray-traced results, or would shader-enhanced realtime results be just as good?
- do you want realtime flythrough of a high quality world, or static still-frame snapshots from a very-very-high quality world?

The main problem is that you will be basically writing an 'exporter' from your data/file format to POVRAY.  Forget that OpenGL is even involved for the moment.  Think of the data you will have (vertices, triangle sets, textures on triangles, light sources, maybe shaders, your own definition of 'objects', etc.), and how you will store it for your application.  Editing/Rendering it is a secondary task for the moment (should of course be kept in mind, so you don't create yourself a problem for optimal rendering/editing!  but bear with me...).

Once you know how your data is stored, you could write a program that converts it into an output file for POVRAY.  This could be a commandline program, or in-memory 'exporter' from your application.

Or, you could also embed a small ray-tracer or radiosity scanline renderer (likely many open source projects out there) into your application as a second rendering method.  Try to keep your modelling data separate from the actual rendering of that data, and you can plug and play different rendering approaches.

-d
0
 

Author Comment

by:Mutley2003
ID: 12096540
Davebytes,
some insightful comments, as usual. thanks.

To answer your questions
- why are you writing this
profit, and fun
- who is your target audience
commercial
- what quality level of output are you looking for
very high .. "knock your socks off". But some aspects could be lower quality

- do you need ray-traced results, or would shader-enhanced realtime results be just as good?

That I don't know. If "shader-enhanced realtime results" are nearly to raytracing standard, then that gives me the best of both worlds. But I don't know enough about shaders.

- do you want realtime flythrough of a high quality world, or static still-frame snapshots from a very-very-high quality world?

Both, ideally. OK, I will back up a bit and explain. I am new to 3D graphics but not new to data analysis - this is a data visualization product. So there is SOME role for flythrough (although it can be slow, more walking than flying) . And SOME role for very-very-high still snapshots that can be printed in large format (A3 or poster)

I started wandering through OpenGL and got some results using an OO framework called VisIT, programmed in Delphi, that hides much of the low level detail - I am not sure they even have shaders. I was not entirely happy. Then I chanced across POVRAY .. very nice images and an accessible language.  But I get the impression from your comments that it is maybe "old hat".

Vertex arrays ? I guess I will have to go back to nehe but my first impression is that it is a huge amount of work. If I understand you correctly, you are suggesting that if I want a sphere in my scene (or worse, something more irregular), I need to build a class that will do all the geometry to represent that as a collection of vertexes!! AAAGH!!
0
 
LVL 17

Expert Comment

by:davebytes
ID: 12098425
Well, no.  If you want a sphere, and you use OO programming to wrapper things, you can let GLUT image you a sphere, and let POVRAY raytrace.  But at some point, primitives don't get the job done, and you need detailed polygonal (or surfaces temp images as triangles) models.

If by 'data visualization' you mean 'home planning' or 'building/office planning', since 'fun' was only one part of your answer and 'profit' was the other, research the field heavily.  There are a growing number of 'simple CAD' programs for say homeowners to place objects around a room and render in 3D.  There are also custom solutions that certain home furnishing stores now use that do the same basic thing.  Know your market, know your competition... There's a lot out there. ;)

When all is done, I'd generally push you to use an existing engine framework if possible, especially if there are a number out there that meet your general needs, esp. wrt POVRAY export support (or built-in raytracer, etc.).

-d
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now