Carving a mesh
Carving a mesh
(at first, i post in advenced help because i think it's a difficult topic. Also, even if i've posted only 3 messages, i've used irrlicht since v0.8 so i'm not a begginer (i'm not saying i'm good with irrlicht ! just not a begginer ))
If you have ever used Worldcraft (HL map editor) you will see exactly what i want to do : the carving function of worldcraft.
The principle is very simple : you use a mesh to carve another.
1) you have two meshes
2) you place the meshes to carve what you want, and you select the mesh which will carve the other
3) you click on "carve" and... magic ! the mesh is carved
I thought a little, and i don't see how to do...
I think we have to use mesh buffers and stuff like this... but that's all...
Have you any idea to do this ?
If you have ever used Worldcraft (HL map editor) you will see exactly what i want to do : the carving function of worldcraft.
The principle is very simple : you use a mesh to carve another.
1) you have two meshes
2) you place the meshes to carve what you want, and you select the mesh which will carve the other
3) you click on "carve" and... magic ! the mesh is carved
I thought a little, and i don't see how to do...
I think we have to use mesh buffers and stuff like this... but that's all...
Have you any idea to do this ?
It is possible but you would need to make a lot of coding in order to get it. With cubes it would be quit simple but anything more complex would need that you make 3D editing tool out of Irrlicht ...which it is currently not. It is graphic engine not modeling tool. No functions/classes suporting something like you want.
arras is right, you can't really do this in irrlicht as it represents everything in triangles rather than shapes. you'd need to make your own format for 3d polygons which make up closed shapes, then write algorithms for operations on them. the reason is closed shapes have a clearly defined inside and outside, which you will need to do boolean operations used in carving.
there's code in burningwater's renderer (aka software2) to clip triangles against a plane, and there's code in the collision manager to tell where the edges of triangles intersect, but working with triangles alone will give messy results. you'll be better off avoiding irrlicht and working with 3d shapes rather than triangles.
there's code in burningwater's renderer (aka software2) to clip triangles against a plane, and there's code in the collision manager to tell where the edges of triangles intersect, but working with triangles alone will give messy results. you'll be better off avoiding irrlicht and working with 3d shapes rather than triangles.
You probably could do what you describe in your screenshots in Irrlicht.
This is CSG (Constructive Solid Geometry). You could probably do it with the stencil buffer. Shader Model 3 shaders may also be an option with their dynamic flow control. Or render-to-depth-texture. There's probably a few ways of doing it.
This is CSG (Constructive Solid Geometry). You could probably do it with the stencil buffer. Shader Model 3 shaders may also be an option with their dynamic flow control. Or render-to-depth-texture. There's probably a few ways of doing it.
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
I think i can achieve this in about 3-4 postprocessing passes. (i love post processors )
It would be cool since once again its means infinite objects for the same speed (well transform and lighting costs are almost neglible compared to complex shaders or cpu based stuff)
Im hungry now, but ill come back with a picture by picture guide on the renderflow.
It would be cool since once again its means infinite objects for the same speed (well transform and lighting costs are almost neglible compared to complex shaders or cpu based stuff)
Im hungry now, but ill come back with a picture by picture guide on the renderflow.
"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
Sorry for the delay, im trying to make the method better by reducing the pass number, currently i have to add an extra pass for a special case(total pentration of the object) maybe i can squeeze stuff in the alpha channel.
"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
Instead of writting a lengthy document, i need to do homework. This is a critical time in my school and i need to study. so this and my volumeteric lighting have to wait. However if anyone is interested in my method here are some pics.
The circled part is the "insides" fragments which will be drawn to give the illusion of an intersection, since this is a postprocessor method no polygons are harmed so you can keep clean meshes nice and .... clean even after intersects.
also all im doing is measuring vectors in eyespace and deciding with simple flowcontrol which pixels get rendered in the end, SM3 wouldnt bring much benift since the flow control only stops 2/3 texture ops, so normal non SM3 cards wouldnt suffer too much.
The circled part is the "insides" fragments which will be drawn to give the illusion of an intersection, since this is a postprocessor method no polygons are harmed so you can keep clean meshes nice and .... clean even after intersects.
also all im doing is measuring vectors in eyespace and deciding with simple flowcontrol which pixels get rendered in the end, SM3 wouldnt bring much benift since the flow control only stops 2/3 texture ops, so normal non SM3 cards wouldnt suffer too much.
"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