Prerendered 3d and collision (Res Evil 2 like) + Perspective
Prerendered 3d and collision (Res Evil 2 like) + Perspective
I'm currently working on a game featuring very detailed graphics
and i have a question for you.
Since i have a lot of objects and characters which are very detailed,
i can't render everything in the game loop since it gets too slow.
I'm wondering if i can do something like in Resident Evil series of games
where all background (that can't be picked up destroyed etc.) is prerendered.
I'm doing my geometry in 3ds max, and it's easy to prerender it from the camera view that i'll be using in game.But how do i do collision with my 'map' in this case, or this can only be done by japanese coders ?
How to make for example prerendered desk in front of character sometimes and sometimes behind,
depending on the char's position ?
I know it's MUCH easier doing this in 3d, but if you have any clues
how to accomplish this in irrlicht shout it out. Thanks.
and i have a question for you.
Since i have a lot of objects and characters which are very detailed,
i can't render everything in the game loop since it gets too slow.
I'm wondering if i can do something like in Resident Evil series of games
where all background (that can't be picked up destroyed etc.) is prerendered.
I'm doing my geometry in 3ds max, and it's easy to prerender it from the camera view that i'll be using in game.But how do i do collision with my 'map' in this case, or this can only be done by japanese coders ?
How to make for example prerendered desk in front of character sometimes and sometimes behind,
depending on the char's position ?
I know it's MUCH easier doing this in 3d, but if you have any clues
how to accomplish this in irrlicht shout it out. Thanks.
Last edited by miha on Fri Jun 29, 2007 8:47 pm, edited 2 times in total.
you need to render things that occlude the layer as a sperate 2d layers with transparency, as collision a normal triselector will work on a simplified mesh of the the room(not rendered).
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
You can also optimize your models and textures to speed up things. On most computers nowadays you could realtime render at least 200.000 triangles each frame. As most commercial games use about 7000 triangles per character, that allows for lots of characters. Maybe something else is slowing you down?
But not in Irrlicht. Commersial engines upload this triangles to GPU just once (on card). Irrlicht will transfer ALL triangles through bus to GPU every frame. So FPS will be low on such high-poly scenes with irrlicht.Robert Y. wrote:You can also optimize your models and textures to speed up things. On most computers nowadays you could realtime render at least 200.000 triangles each frame
To Niko: please! Add Vertex/Hardware buffers! This is the last obstacle between irrlicht and world domination
I was trying to make this kind of game too.
Here's how I solved it.
1. Prender your background ( in 3dsmax )
2. Export the same scene with less polygons.
3. Load the scene in irrlicht.
4. beginScene()
4.1 Render the scene (no material, no lighting, only the mesh), exclude the characters ( invisible ).
5. Then draw the prerendered background.
6. Finally draw the characters and meshes you want to show realtime.
7. endScene()
The rendering of the low poly scene is necessary to fill the Z-buffer and you can use the mesh for collision too.
It would be easier if Z-buffer information could be saved in the background image already and written to the Z-buffer while drawing the image. This would be more precise but also more complex to realize.
And I don't think it would work with irrlicht. Or does anyone know how to fill the Z-buffer from an image in Irrlicht
Here's how I solved it.
1. Prender your background ( in 3dsmax )
2. Export the same scene with less polygons.
3. Load the scene in irrlicht.
4. beginScene()
4.1 Render the scene (no material, no lighting, only the mesh), exclude the characters ( invisible ).
5. Then draw the prerendered background.
6. Finally draw the characters and meshes you want to show realtime.
7. endScene()
The rendering of the low poly scene is necessary to fill the Z-buffer and you can use the mesh for collision too.
It would be easier if Z-buffer information could be saved in the background image already and written to the Z-buffer while drawing the image. This would be more precise but also more complex to realize.
And I don't think it would work with irrlicht. Or does anyone know how to fill the Z-buffer from an image in Irrlicht
I think each graphics card holds the z-buffer in a different way, so it would be awkward if not impossible to populate it with some predefined image.
you could render to a depth texture using a shader (like when making shadow maps), then use another pass to compare your pre-rendered depth texture with the one you just made.
you could use all 4 channels of your pre-rendered texture to do other funky overlay effects too, like blur around light sources etc
you could render to a depth texture using a shader (like when making shadow maps), then use another pass to compare your pre-rendered depth texture with the one you just made.
you could use all 4 channels of your pre-rendered texture to do other funky overlay effects too, like blur around light sources etc
The z buffer pop is pretty good idea ( i think the residentevil games used layers)
If you are going to use z buffer stuff with fixed function comparision (no shaders) you should have the following render layout.
draw the prerendered image to a polygon.
draw simplified polygon mesh (same one you use for colldetect) with z buffer writes on and colour writes off. The colour write off is very important
draw dynamic models
there is another way where you draw things like:
draw simple mesh normally.
draw prerendered data on 1 polygon using z writes disabled.
then draw dynamic objects.
Both require engine modifications (to the dll) so ask here for more info.
If you are going to use z buffer stuff with fixed function comparision (no shaders) you should have the following render layout.
draw the prerendered image to a polygon.
draw simplified polygon mesh (same one you use for colldetect) with z buffer writes on and colour writes off. The colour write off is very important
draw dynamic models
there is another way where you draw things like:
draw simple mesh normally.
draw prerendered data on 1 polygon using z writes disabled.
then draw dynamic objects.
Both require engine modifications (to the dll) so ask here for more info.
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
Actually I was talking about Irrlicht scenes. 200k triangles are handled well by irrlicht, but you can optimize your models for speed increasement (reduce triangles and sort the indices and vertices). Of course hardware buffers would be a great improvement, but Irrlicht is quite fast at the moment. I tried Quest3D, which is optimized for DirectX9 and uses hardware buffers. Indeed it is faster on my newest computer, with a modern gfx card but on my old computers (667MHz with Nvidia tnt2 32MB) Irrlicht performs much better.IPv6 wrote: But not in Irrlicht. Commersial engines upload this triangles to GPU just once (on card). Irrlicht will transfer ALL triangles through bus to GPU every frame. So FPS will be low on such high-poly scenes with irrlicht.
Characters are not that much of a problem.I have just a couple of themRobert Y. wrote:You can also optimize your models and textures to speed up things. On most computers nowadays you could realtime render at least 200.000 triangles each frame. As most commercial games use about 7000 triangles per character, that allows for lots of characters. Maybe something else is slowing you down?
in the scene,but the real slowdown comes from the background which uses
far more triangles than a majority of commercial games.I have mostly
interiors with a lot of detail and animation and very demanding but
discrete particle fx.->Means they take a lot of resources, but are not that
much obvious.Unlike to someone making a big explosion made of not
very much particles and because of that looking bad, my philosophy is
completely opposite to that.I like it very stylish.
I was thinking to make it less precise and do everything in 3d, but
omaremad gave me a great idea that really made up my mind.
It's very interesting discussion though.
What About Perspective?
About the poly and tri count.
I just did a poly count in 3d studio for my table model
and it gave me about 4200 polygons.Every little object in the scene has
a lot of polys and i really need prerendering to make it go fast.
What about the views.I thought it ain't gona be tough but...
I did some tries in that direction and i think it's gonna be a hell of a tough
job getting the perfect equality between 3ds camera position when
prerendering,and camera position in irrlicht.If anyone has an idea about
getting the perfect views, he's welcome.
I just did a poly count in 3d studio for my table model
and it gave me about 4200 polygons.Every little object in the scene has
a lot of polys and i really need prerendering to make it go fast.
What about the views.I thought it ain't gona be tough but...
I did some tries in that direction and i think it's gonna be a hell of a tough
job getting the perfect equality between 3ds camera position when
prerendering,and camera position in irrlicht.If anyone has an idea about
getting the perfect views, he's welcome.
That IS one great idea.bitplane wrote:I think each graphics card holds the z-buffer in a different way, so it would be awkward if not impossible to populate it with some predefined image.
you could render to a depth texture using a shader (like when making shadow maps), then use another pass to compare your pre-rendered depth texture with the one you just made.
you could use all 4 channels of your pre-rendered texture to do other funky overlay effects too, like blur around light sources etc
I might as well try doing that.
I'm currently switching from VS6 to VS2005 so i thought i take
a break of programming for a couple of days.Somehow i don't
have idea how to match the prerendered view perspective with
the camera position in irrlicht.Do 3dsMax and irr have any way of
synchronising, like 3ds tels me how the position of camera is relative to
something (0,0,0-coord?) that can be used to match it in irr?
Anyway it's very tough,but i like things like this,feels very good when
solved.
Last edited by miha on Sun Jul 01, 2007 6:05 pm, edited 1 time in total.