Replicating Plane Thickness and position w/ Cube
Blitz3D Forums/Blitz3D Beginners Area/Replicating Plane Thickness and position w/ Cube
| ||
I'm trying to switch to cube and not using plane anymore. I'm getting some jittering effect when I used a flattened cube with a defined width and length along with primitives on top, say another cube (not flattened) Any ideas on how you can create the same with cube at position 0,0,0 and the same thickness as CreatePlane(). |
| ||
Not sure what you mean. A plane is infinitely broad and of zero thickness. A cube has finite non zero dimensions. You can of course svale a cube so it is broad but thin....is that what you mean? |
| ||
Thanks Matty, Ok so nevermind the thickness. Any size will do, as long as it won't jitter when I put primitives on top. Kinda like floor (plane) and structure (cube,meshes) Maybe start something like 100x100 in scale, I can't really line up the flattened cube and other meshes on top without experiencing any jittering. Is this still possible? |
| ||
You could simply create a big flat rectangle mesh (like 1000units*1000units), 4 vertices, 2 triangles. Also, make sure to define appropriate u,v coords so that the texture will be applied the same way than on the plane. |
| ||
I think that could work RemiD, will try it thanks! |
| ||
I'm getting some jittering effect when I used a flattened cube That's called Z-fighting, it's caused by geometry from different objects occupying the same location in space, so in certain frames some pixels of an object go in front of pixels of the other, and vice versa. They have equal values in the depth buffer. https://en.wikipedia.org/wiki/Z-fighting |
| ||
Yes, that seems to be the case Kryzon. Do you have any example solution? thanks |
| ||
Use a flat rectangle mesh like RemiD suggested, or use EntityOrder to render the ground first, before everything. |
| ||
If you problem is z-fighting, the solution is to move/position your meshes a bit higher so that they do not cross the plane... or to move their bottom vertices a bit higher in your modeling tool... |
| ||
sorry guys, I'm not good at calculating blitz3d units so maybe a simple example 1 cube flattened and 1 cube on top is all I need to see. It looks like I just need to create the plane from blender. |
| ||
using Fragmotion, i model everything with 1 fragmotionunit = 1 centimeter, then when i load the mesh inside Blitz3d, i scale down by 0.01. This gives me perfectly sized meshes that i can then position/oriente precisely in the scene (essential if one day you want to procedurally build a scene with parts) Firstly you want to decide at which size you want to model your meshes in Blender (preferably by using 1blenderunit = 1meter or 1decimeter or 1centimeter or 1millimeter), then export a 1w1h1d cube and load it inside Blitz3d. Then do some tests by scaling up or down to find the precise scale factor. Then always use the same modeling size/grid and always use the same scale factor to load the mesh and all will work well. |
| ||
Btw, a Blitz3d cube, with default size, has a radius of 1 ! So in order to have a 1w1h1d cube inside Blitz3d, use this code : 1w1h1dCube = createcube() scalemesh(1w1h1dCube,1.0/2,1.0/2,1.0/2) |
| ||
thanks, is that supposed to work in conjunction with the fakeplane? btw you forgot about var name starts with 1 or num throws an error ;-) |
| ||
is that supposed to work in conjunction with the fakeplane? it is supposed to help you modelize, export, load, scale, your meshes precisely so that the vertices/edges do not go through the plane/ground/floor. |
| ||
I'm getting some jittering effect when I used a flattened cube with a defined width and length along with primitives on top, say another cube (not flattened) We could use an example of this to demonstrate the problem. Without it we are just guessing what needs to be fixed. |
| ||
Thanks guys. I know I can achieve this by just generating models in Blender and export it in B3D. What I'm trying to do is replicate it without the use of any tool or through CreateCube() method. I'm curious if it is possible and without the z-fighting. So far I'm failing and don't know the exact scale and position of the 2 objects to achieve this, that's why I'm asking this particular problem. |
| ||
What do you want exactly ? A scene made in code with a plane and a 1w1h1d cube ? |
| ||
Yes please, without the z-fighting. If it's not possible then it's ok, I guess I have to do it in Blender. |
| ||
here : Also note that to prevent z-fighting you want to have a factor of 1000 maximum between the near camerarange and the far camerarange (in this example 0.1,100) |
| ||
thanks RemiD. Looks like it works but I have not fully tested it yet. be back on this. |
| ||
There are 3 views from a humanoid pov in this scene : -stand up view -crouch down view -lay down view And as you can see, no z-fighting problem. |
| ||
got it, thanks. I'll be adding a freelook camera and some textures to check it out. The z-fighting usually shows up when you move the camera. |
| ||
Are you sure that what you describe as z-fighting is not the min value of the camerarange which is too high ? |
| ||
I'm not sure but when I use plane at 0,0,0 there's no z-fighting when I place a cube on top. |