Detecting material used in vertex groups

View previous topic View next topic Go down

Detecting material used in vertex groups

Post  Feenix on Wed May 06, 2009 9:38 am

Greetings all

I have been playing around with SIO2 for the past few days and am slowly getting to grips with things (I'm somewhat new to 3D graphics programming/modeling so trying not to make my brain explode with all the new knowledge).

I'm wondering if anyone could shed some light on the following problem. I want to have a surface that is composed of multiple materials. I also want to be able to detect when an object on the surface moves from material to material. For example, imagine a track made up of sand/road/gavel/other materials. I want to be able to detect when an object moves from one material to the next.

The second criteria is that I would like to be able to create the layout of the materials (i.e. what material goes where) dynamically in code. The surface may be a plane or it may be curved.

I've thought about a few options;

1. Create a surface (plane or curved) in Blender, somehow divide it into a square grid, assign each grid component to a vertex group and at runtime, assign different materials to each group through the code. Use sensors and collisions (I have to admit, I haven't looked deep into these yet) or possibly ray casting (from object to surface) or some form of position checking to determine which vertex group the object is on and retrieve the material name associated with that group.

2. Create separate polygon objects at runtime via duplicating and position them onto the surface layout I want (this could be more difficult if I wish to use curves rather than a flat plane). With this method I would envision using Blender to model the surface layout and then in code move the different objects with their associated material to cover the surface (basically using the surface as a guide, trivial if it is a plane). Use the same methods as 1. to determine which material the object is on.

My questions are;
Is there an SIO2 api call to retrieve vertex group properties (e.g. material) that I'm missing, or do I need to query the object data directly?

How does either of those approaches sound to those more experienced in 3D graphics? Since I'm still getting my feet wet in the field I am always aware that there is generally easier ways to do things that I haven't discovered yet so chances are I'm over-complicating things.

Thanks in advance

Feenix

Posts : 2
Join date : 2009-05-06

View user profile

Back to top Go down

Re: Detecting material used in vertex groups

Post  sw on Fri May 08, 2009 11:30 am

I saw the bullet engine has a topic about this , you can search it in the demo code.
avatar
sw

Posts : 73
Join date : 2008-10-12

View user profile

Back to top Go down

Re: Detecting material used in vertex groups

Post  Feenix on Sat May 09, 2009 8:24 am

Thanks for the suggestion sw. I'll have a look at the bullet sdk to get some pointers as to best way to approach it.

Feenix

Posts : 2
Join date : 2009-05-06

View user profile

Back to top Go down

Re: Detecting material used in vertex groups

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum