Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

OpenGL to POVRAY

Posted on 2004-09-18
4
Medium Priority
?
869 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
3 Comments
 
LVL 17

Accepted Solution

by:
davebytes earned 1500 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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

571 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