Volumes Of Fun http://www.volumesoffun.com/phpBB3/ |
|
Voxel type http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=382 |
Page 1 of 1 |
Author: | xelons [ Sun Apr 15, 2012 3:53 pm ] |
Post subject: | Voxel type |
Greetings everyone, I'm a little bit confused about the voxel types and would like some help regarding this matter. What I'm trying to do is the following: let's say I have set a voxel at a location x, y, z, I would like to assign a type for that specific voxel, let's say the type is an int value, so It would be a voxel at x, y, z location with let's say 1 as an int value assigned to it. The purpose of this is to be able to set a per voxel propriety like grass, dirt etc. So is there an already made implementation into polyvox that allow us to do the following? Like defining an enumeration from let's say 0 to 10, with 0 assigned to grass, 1 assigned to rock and so on, then once we set a voxel we can have the option to specify a type ranging from 0 to 10 for example and save it with that specific voxel, so later on we can access that type and assign whatever propriety we want to that voxel. I hope my explanation was clear enough ![]() |
Author: | ker [ Sun Apr 15, 2012 4:23 pm ] |
Post subject: | Re: Voxel type |
not sure if i got it right. you want to set a type (e.g. "grass", "earth") and then, depending on the type set some other value? ("grass" -> "green", "brown", "earth" -> "good soil", "stony") or do you simply want to set a voxel to an enum? if it is the latter, that is already possible. just create your enum Code: enum MyMaterial { mmAir, mmEarth, mmGrass, mmWater }; and use PolyVox::Material8. Code: volume.SetVoxelAt(x, y, z, PolyVox::Material8(mmEarth)); if it is the first one, you will need your own Material implementation (which is not all that difficult to implement) |
Author: | xelons [ Sun Apr 15, 2012 5:53 pm ] |
Post subject: | Re: Voxel type |
ker wrote: not sure if i got it right. you want to set a type (e.g. "grass", "earth") and then, depending on the type set some other value? ("grass" -> "green", "brown", "earth" -> "good soil", "stony") or do you simply want to set a voxel to an enum? if it is the latter, that is already possible. just create your enum Code: enum MyMaterial { mmAir, mmEarth, mmGrass, mmWater }; and use PolyVox::Material8. Code: volume.SetVoxelAt(x, y, z, PolyVox::Material8(mmEarth)); if it is the first one, you will need your own Material implementation (which is not all that difficult to implement) Thanks Ker, that's what I needed, actually I kinda need this for the two reasons you stated above, my terrain is textured using an auto texture system, it takes the y normal of the voxel surfaces and then depending on the angle value from 0 to 1 it assign a texture, the problem with this implementation is that if I try to add trees for example they will get the same auto texturing. Now if I assign a type to some voxels I can exclude it from my auto texturing process and apply the desired texture and proprieties that I want ![]() EDIT: Code: volume.SetVoxelAt(x, y, z, PolyVox::Material8(mmEarth)); SetVoxelAt, isn't the last parameter controlling the density of the voxel? |
Author: | ker [ Sun Apr 15, 2012 7:34 pm ] |
Post subject: | Re: Voxel type |
xelons wrote: SetVoxelAt, isn't the last parameter controlling the density of the voxel? nope, it is controlling the voxel itself. you will assign the whole voxel. You can use any c++ object as a voxel type. so for your case you'll have to create one that has a field for material and one for variation. you best copy the Material class and add whatever extra stuff you need. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |