Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
real-time constructive solid geometry #304551
01/08/10 19:04
01/08/10 19:04
Joined: Jan 2010
Posts: 44
Galati, Romania
CItrok Offline OP
Newbie
CItrok  Offline OP
Newbie

Joined: Jan 2010
Posts: 44
Galati, Romania
I am newbie. I need to build a small application to demonstrate real-time constructive solid geometry between two models. So, I want to subtract one basic model from another (boolean difference). Let's say I want to subtract a cylinder from a box to create a box with a cylindrical hole in it. The cylinder is moved by me in the game. IS this possible in lite-C enviroment?

In order to be more explicit concerning boolean subtraction see
http://en.wikipedia.org/wiki/Constructive_solid_geometry

Thank you guys.

Re: real-time constructive solid geometry [Re: CItrok] #304552
01/08/10 19:17
01/08/10 19:17
Joined: Mar 2009
Posts: 40
DR_Black Offline
Newbie
DR_Black  Offline
Newbie

Joined: Mar 2009
Posts: 40
Another similar question asked in other thread and people argue around.

I think it is possible via shaders. I meat you can fake it using shaders .So instead of building real boolean difference you can use a shader to fake it.

I am not a shader expert so i cant go further.


every body got some dues in life to pay
Re: real-time constructive solid geometry [Re: DR_Black] #304556
01/08/10 19:44
01/08/10 19:44
Joined: Apr 2008
Posts: 235
TEXCOORD3
Foxfire Offline
Member
Foxfire  Offline
Member

Joined: Apr 2008
Posts: 235
TEXCOORD3
this can be done but is relatively complicated.

Also, doing this with primitives is different from models - heres how to do it with primitives, including rendering in GS:

first, you need a sort class to store data:
as you read on wikepedia, CSG can be represented by various primitives connected to each other via boolean arithmetic (+ or -).

so, in lite-c we don't have classes, but we can use variables instead.
so, for your example, we would store data for a cube and a cylinder and "link" them together (in C++ you could just make a shape class that has another Shape variable inside), lite-c you'll have to play around :\

when rendering, you have 2 choices - represent your geometry as polygons via dynamically created data, or render s-curves or dots/lines with d3d_draw.

for the first, we can use a recursive subdivision routine that will base its starting values on the intersection points between the two shapes. Check our ray-line intersection equations for this. So, you will create a list of vertices by analyzing each point on the parent shape. if the said point is intersecting with the child shape, you replace the intersection volume location with the equation for the child shape and continue. The result will be a highly tesselated model that will render via draw_begin and sending the vertices as a vertex buffer to d3d. you could also render each vertex as a point for an easier way of showing the mesh without too much directX knowledge.

if you need more specifics, contact me - I know my explanation is a bit confusing - I don't have enough room or time right now to explain in even more detail.

ps, intersecting 2 models can be done in the same way but using ray-polygon intersection and testing every polygon against the sample point (its slow but this is the easiest way to implement).

-Mike-


http://www.groundtacticsgame.com/
Alienware m17x R Custom laptop
specs:
Intel Core 2 Extreme Quad CPU Q9300
2x Nvidia 280GTX 2GB vram
6GB ddr3 memory@ 1333Mhz
512GB SSD
1200p 17' screen
runs Crysis Warhead on max settings at 1200p at 90 fps
Re: real-time constructive solid geometry [Re: Foxfire] #304557
01/08/10 20:03
01/08/10 20:03
Joined: Jan 2010
Posts: 44
Galati, Romania
CItrok Offline OP
Newbie
CItrok  Offline OP
Newbie

Joined: Jan 2010
Posts: 44
Galati, Romania
Mike, thanks for the fast reply. I just started to learn 3d game studio for 3 days so i must confess I am not able to do this at the time. I thought is much simpler to do this. I will try to follow step by step other newbie tutorial.

Will be great if they could implement such features.

Thank you very much once again.

Re: real-time constructive solid geometry [Re: CItrok] #304558
01/08/10 20:05
01/08/10 20:05
Joined: Jan 2010
Posts: 44
Galati, Romania
CItrok Offline OP
Newbie
CItrok  Offline OP
Newbie

Joined: Jan 2010
Posts: 44
Galati, Romania
Me again...With the models will be much simpler? Can you suggest some steps? Thank you very much.

Re: real-time constructive solid geometry [Re: Foxfire] #304561
01/08/10 20:28
01/08/10 20:28
Joined: Mar 2009
Posts: 40
DR_Black Offline
Newbie
DR_Black  Offline
Newbie

Joined: Mar 2009
Posts: 40
I am so confused foxfire.
I didt mean geometry modification via complex vertex shaders. I mean if there is way not to really do it but make it appear like that using a view-dependent method. i have no exact idea how should it be. but i think its possible.
let me give you a deeper plan:
we have two objects (models) one to be subtracted(B) and one as knife(B)
firs we render (A) to stencil buffer then using stencil buffer we render (B) on screen with flip normals, so til now we have rendered B with fliped normals only on pixels were A and B are overlaping (interrelate). Then we render Last B once again using stencil buffer but instead of screen we use stencil buffer as render target. finally we render A using stencil buffer on screen. after all we have a rendered total screen. A and B are:
1-B is not rendered but in interrelate areas it is rendered whit fliped normals
2-A is rendered but in interrelate areas it is not rendered

it may have some problems specially with texture and UVs.
I think it may work but i dont know how to implement it. i hope you understand my approach.


every body got some dues in life to pay
Re: real-time constructive solid geometry [Re: DR_Black] #304567
01/08/10 21:04
01/08/10 21:04
Joined: Jan 2010
Posts: 44
Galati, Romania
CItrok Offline OP
Newbie
CItrok  Offline OP
Newbie

Joined: Jan 2010
Posts: 44
Galati, Romania
Dr_Black, I want geometry modification of the "subtracted" object (model). As a matter of fact I want to be able to see, what is the shape the "subtracted" object.

Re: real-time constructive solid geometry [Re: CItrok] #304580
01/08/10 22:39
01/08/10 22:39
Joined: Apr 2008
Posts: 235
TEXCOORD3
Foxfire Offline
Member
Foxfire  Offline
Member

Joined: Apr 2008
Posts: 235
TEXCOORD3
yeah, I'm talking about just CSG as an algorithm and how to basically build a procedural model to render - it doesn't need any shaders or anything - this is done on the CPU. You can render it by just making a vertex buffer based on the 3d points and their neighbors.

anyway - I can help you in person, just add me on msn =]

-Mike-


http://www.groundtacticsgame.com/
Alienware m17x R Custom laptop
specs:
Intel Core 2 Extreme Quad CPU Q9300
2x Nvidia 280GTX 2GB vram
6GB ddr3 memory@ 1333Mhz
512GB SSD
1200p 17' screen
runs Crysis Warhead on max settings at 1200p at 90 fps
Re: real-time constructive solid geometry [Re: Foxfire] #304581
01/08/10 22:41
01/08/10 22:41
Joined: Apr 2008
Posts: 235
TEXCOORD3
Foxfire Offline
Member
Foxfire  Offline
Member

Joined: Apr 2008
Posts: 235
TEXCOORD3
oh, and DR-Black, that is a clever idea for real-time CSG. but i think he wants to actually do single calculations and store the result. Either way I know how to do it. Dr-Black, feel free to add me on msn too - we can colaborate (the 3 of us) to figure out a working implementation in GS. -Mike-


http://www.groundtacticsgame.com/
Alienware m17x R Custom laptop
specs:
Intel Core 2 Extreme Quad CPU Q9300
2x Nvidia 280GTX 2GB vram
6GB ddr3 memory@ 1333Mhz
512GB SSD
1200p 17' screen
runs Crysis Warhead on max settings at 1200p at 90 fps
Re: real-time constructive solid geometry [Re: CItrok] #304586
01/08/10 23:01
01/08/10 23:01
Joined: Mar 2007
Posts: 112
MikeS Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
one question, do you need it for presentation?

Or do you need this stuff for real?

If you need it for a presentation, you maybe could work with ent_morph and ent_create?

greetings

Mike

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1