3D entity parts not showing correctly

👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈



Hi, I am having a problem with the goal nets on the near side not showing correctly. I have the areas circled in red. Anyone know how I can fix this?
The object is .3ds format. It also does the same thing with .x format.

Edit: I will be removing the adboards so it will only be the 2 goals and the field.

RasterRon commented:

The object is .3ds format. It also does the same thing with .x format.

Try converting it to b3d format..

Edit : I see that my image link isn't working, I'll try to fix it after work today.


Welcome aboard. 🎉

ManuallyInstalled commented:

Here is the image. I'd rather have the link show instead of the image like RasterRon's, but if having the image show is the only way I can get it to work, I guess I will do it that way.

How can I convert the object to b3d? The only way I heard about is getting the b3d exporter plugin for blender

RemiD commented:

it may be that you have modeled the 'net' only on one side and not on the other side, maybe try to add tirangles (and apply the texture) on both sides.

it may be a z-ordering issue (of triangles textured with an alpha texture), try to load the texture with the mask flag instead of the alpha flag loadtexture("texture.png", 1+4 ). (the mask flag will hide all texels which have a 0, 0, 0 color (black).

it may be that the exporter that you use exports incorrectly. the b3d exporter of fragmotion works well, not sure about the exporter of blender.

Grindalf commented:

As RemiD says "you have modeled the 'net' only on one side and not on the other side" For context some 3D modellers have Backface culling off so it may look like its modeled on both sides when in fact its not.
Blitz3D has Backface Culling turned on so a triangle can only be seen from one side. Check through your 3D model program settings and see if you can Turn Back Face Culling On

ManuallyInstalled commented:

Actually, I bought the pitch, goals and adboards from Turbosquid. They came together as 1 file. It came as .obj among others. I didn't think Blitz3d supported anything, but x, 3ds and B3D so I loaded the obj file into Wings 3D and converted to both x and 3ds and get the same result in Blitz3d.

Also, the model looks fine in both Blender and Wings 3D.

I will try the mask flag after work and see how that goes

Grindalf commented:

One question. In Blitz3D does it look fine on the inside of the goal?

RemiD commented:

the best format for blitz3d is .b3d (especially for rigged skinned animated meshes or meshes with pivots like maps).

i have written some procedures to import / export an .obj mesh inside Blitz3d, some years ago.
i will take a look if i can find it.

RemiD commented:

i have not found my procedures to import / export an .obj mesh inside Blitz3d. (but i am sure to have coded these procedures, weird...)

but there are several in the code archives :


ManuallyInstalled commented:

I would have to reposition the camera to see the inside of the goals to find out
Edit: Yes, the inside of the goals are there, I just tested it

@RemiD and Grindalf
I have downloaded the 3ds file from Turbosquid and loaded it into Fragmotion and when you look at the goals the front side of both are not showing, only the back one's are showing. If I turn the scene in Fragmotion around to see if the other side shows when it is in front, it shows and the back one is hidden

Edit: Another note:
As you see in the image below, when I loaded the file into Fragmotion the pitch image was already on the object. As far as the goals and the adboards texture I have no idea yet how to get it to show on them in Fragmotion yet.
In the original image I posted above the only image I had to load in the code was the pitch image called "field.png". I don't know how to use Fragmotion yet so I know very little about it.

Edit: I just looked on Turbosquid and saw that there is another image called "soccer.mtl" it is 1kb. ( I though .mtl is an object file not texture, but Turbosquid says in my downloads that it is a texture)
Edit: Again I just downloaded the obj file from Turbosquid and loaded it into Wings 3D and Everything shows textured without me doing anything but import the file, but if I import or load into Fragmotion it only shows the pitch by itself and textured. Hmm


Blender Animation Render: Kinda low lighting. I moved the light source to middle of field

RemiD commented:

if you have managed to load the model in fragmotion, i can help you.

what you describe is quite easy to solve, and what we have said : the 'net' has triangles only on one side and not the other.

you could disable backface culling for the whole mesh (with entityfx() ), but if it does that for all the surfaces of the mesh, this will render many more triangles unecessarily.

you could make the 'net' a separate surface and only disable backface culling on this surface ( with brushfx() )

the best solution imo is to add triangles to the 'net' so that there are on both sides, inside a model editor (like Fragmotion).

to do this in Fragmotion :
select all triangles of the 'net' on one side. (make sure to not select any other triangle)
click on menu bar >> edit >> duplicate mesh selection
keep this selection
click on menu bar >> face >> reverse vertex order

then scale your mesh at the appropriate size (you can create a cube with a 1width1height1depth to have an idea of the size of your mesh)
then export it as b3d
then load it inside blitz3d and scale your mesh at the appropriate size (you can create a cube with a 1width1height1depth to have an idea of the size of your mesh)

it should work.

RemiD commented:

write this in blitz3d and tell me what it return :
debuglog(countsurfaces(mesh)) ;(mesh being the whole mesh that you have loaded...)
with debuglog activated...

if the 'net' is already a separate surface, we can try to disable backface culling only on this surface, and let the others surfaces as they are (already textured)

ManuallyInstalled commented:

I tried the EntityFX() command and it worked, at least I think it did to some degree.
The weird thing about the model I have loading, it that the only texture I have to load with code is the field/pitch texture. As I said in previous post, the model came with 2 textures one for the field and one for both the adboards and goal nets.
The adboards and nets one must be an atlas texture because it is one texture for all adboards and both nets, but I don't have to load the adboard and nets texture. Is there any way I can make the black color of the nets transparent?
I started this code as just a test to learn. Should I go ahead and separate the nets from the field and load the nets along with the texture to do the Fragmotion thing you mentioned?

Edit: I just ran the EntityFX() command set as EntityFX(socFld,16+32) after I ran the below code and it looks transparent at least within itself, but the black is still there. I can see the white bars through the net area, but can't see anything behind it as real transparency should be. I also loaded the ad boards and nets texture into Gimp and there is not black in the net area, it looks to be transparent.
I happened to change the position of the entity to see a net up closer and it does show some stuff that shouldn't be seen at that angle. So, I might work on the model in Fragmotion with your help. Or I can create nets myself.

; set screen size
Graphics3D 1920,1080
SetBuffer BackBuffer() 

; camera setup

; ambient light
AmbientLight 250,250,250

; load mesh and position entity
socFld=LoadMesh("soccer1.3ds") : PositionEntity socFld,0,0,12

; texture mesh
EntityTexture socFld,FTxtr,0,1

; main loop
While Not KeyDown( 1 )



RemiD commented:

maybe there are several surfaces in your mesh...
use debuglog( countsurfaces(mesh) ) to check this...

you can load a texture with the 'mask' flag (to hide black texels) with texture = loadtexture("texture.png",1+4)
then apply this texture using entitytexture() (on all surfaces of the mesh) or brushtexture() + paintsurface() (on 1 surface of the mesh)

ManuallyInstalled commented:

I just ran the debuglog thing and it said 2

I believe I figured it out.

  1. Loaded obj model into Wings3d
  2. Removed the field and ad boards and exported the goal nets as separate 3ds file
  3. Clicked undo to get the field back and leave out the ad boards
  4. Removed goal nets and exported the field out as a separate 3ds file
  5. Loaded both the field and goal nets into Blitz3d with the separate files I saved and textured them
  6. Experimented with the code until I got the following code and result

I only see 1 issue and that is the far white bar down on the field of the right goal isn't showing
I have been experimenting with the model coordinates positioning and rotating them. It seems that something about the models is off (like one end bar is thicker than the other and the author duplicated the first goal and rotated it for the other goal). When I rotate the nets slightly in hopes that the far side on right net shows up. I have gotten close, but not right. Also, I have repositioned the objects to the left of the camera and closer to the camera to see the right net better and when I do that I see the far white bar. Could that be a lighting issue or camera issue or both including a range issue for one or the other or both?

; set screen size
Graphics3D 1920,1080
SetBuffer BackBuffer() 

; camera setup

; create light and position it

; ambient light
AmbientLight 150,150,150

; load pitch mesh and position entity
socFld=LoadMesh("pitch.3ds") : PositionEntity(socFld,0,0,12)

; load goal nets and position entity
socGls=LoadMesh("GoalNets.3ds") : PositionEntity(socGls,0,0,12)

; disable back culling(16) and force alpha blending(32)

; texture pitch mesh
FTxtr=LoadTexture("field.png", 4)

; texture goal nets mesh
GTxtr=LoadTexture("stadium_.png", 4)

; point light at pitch

; main loop
While Not KeyDown(1)



ManuallyInstalled commented:

Thank you RemiD and Grindalf for your help. I'll keep working on things to get the rest done.

RemiD commented:

this means that you have 2 surfaces in this mesh.

you can texture each surface with a separate texture.

this is useful because the 'net' triangles needs to be textured with an alpha / masked texture (so that some texels are transparent ).
and the remaining triangles can be textured with a color texture (so that all texels are opaque)

here is a simple function to texture each surface of the mesh with a different texture, inside blitz3d :

surface1 = getsurface( mesh, 1 )
surface2 = getsurface( mesh, 2 )

stadiumtexture = loadtexture("stadium.png", 1 )
nettexture = loadtexture("net.png", 1+4 ) 
; (1 to have only colored texels, 1+4 to mask the black texels, 1+2 to have a progressive transparency (alpha) of the texels depending on their darkness / brightness )

;use it like entitytexture( mesh, texture ), but give it a surface instead of a mesh...
;give fx the value '0' to render the mesh normally, or the value '16' to disable the backface culling, for the 'net'... (to render the triangles both sides)
function SurfaceTexture( surface, texture, fx%=0 )

 tbrush = createbrush()
 brushfx( tbrush, fx )
 brushtexture( tbrush, texture )

 paintsurface( surface, tbrush )

 freebrush( tbrush )

end function
ManuallyInstalled commented:

Thank you, I'll take a look at it after work

Reply To Topic (minimum 10 characters)

Please log in to reply