Skip to main content
gamedev.net
🔒 Locked

help in rendering please...

Started by BigFatBaby 4 replies 650+ views
Original Post
BigFatBaby
BigFatBaby
hello, i have a project that is similar to the well-known 3dsmax. tohugh my 3d space is in fact the OGL, i need to add an option of rendering a single image (a sort of snapshot from a perticular view). does anyone know how the rendering process works? i really need it (processor time is not a factor, but with almost everything faster is better) ---------------------------------------------------------- Winners never quit Quitters never win But those who never win and never quit are idiots!!!
----------------------------------------------------------I dont have syntax error....Only logical ones...
666_1337
666_1337
i don't know exactly what you understand in "option of rendreing a single image", but why don't you just grad the image with glReadPixels and convert it to whatever format you need it?


        
void recalculateModelVertices(...)
{
...
if(one_of_the_models_vertices_have_changed)
{
if(image != NULL)
{
free(image);
}
image = (unsigned char*)malloc(viewport[2]*viewport[3]*sizeof(char));

glClear(GL_COLOR_BUFFER_BIT | GL_DEPHT_BUFFER_BIT | ...);
drawTheScene(...);
glReadPixels(0, 0, viewport[2], viewport[3], GL_RGBA, GL_UNSIGNED_BYTE, image);
}
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BITS);
glDrawPixels(viewport[2], viewport[3], GL_RGBA, GL_UNSIGNED_BYTE, image);
glutSwap();//or whatever you use

}


[edited by - 666_1337 on March 9, 2003 6:56:46 AM]
our new version has many new and good features. sadly, the good nes are not new and the new nes are not good oo
Expendable
Expendable
BigFatBaby,

When you construct a model in 3dsmax, the model is being displayed via OpenGL in the various viewports (or whatever renderer you''ve chosen for your particular configuration). But when you go to "render" an image, 3dsmax is creating the image entirely in software via raytracing. It is calculating individual light-rays and how they reflect and refract off each surface (i.e., thousands upon thousands of mathmatical equations!). The best you can hope for in your own project is just to capture the pixels in your viewport as 666_1337 suggests -- unless you want to write your own software renderer and calculate the rays yourself (which I''m guessing is probably one of the most difficult things to do in computer graphics programming!)
E-x-p-e-n-d-a-b-l-e
BigFatBaby
BigFatBaby
thank you for your assistance, though i am disapointed that there isnt a library i can just add to my project...
the mathematical section of my project is completed, and without the presence of a rendering engine...

i guess i will just have to do without...

----------------------------------------------------------
I dont have syntax error....
Only logical ones...
----------------------------------------------------------I dont have syntax error....Only logical ones...
Mayrel
Mayrel
Raytracers are pretty trivial, but they are slow. The basic idea is quite simple (particularly when working only with triangles).

1. fire a ray from the eye through the current pixel in the viewing plane.
2. test the ray against every face in the scene, nearest first. (use octrees, BSP, whatever, to reduce the number of faces you have to check).
3. when you find a face the ray has intersected, determine where it hit it in face coordinates - you need this to determine the normal (if you''re doing smooth shading), the texture coordinates, and you''ll need to know where to trace another ray from if you''re tracing reflections, shadows, refractions, etc. 3DS typically pregenerates reflection and shadow maps, so that reflections and shadows are just another kind of texture.
4. move to the next pixel, return to step 1.



Best viewed with irony.

Hail Eris! All fnord hail Discordia!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.