Hi, long time lurker here!
I've been programming since I was a little kid (I'm 24 now), but I'm quite new to working with 3D. This morning I was working on some Level-Of-Detail code for a game I'm planning, and this is what I came up with:
Opinions? Any way I can improve on this? At the moment it's not too bad. I created a random 'galaxy' with 5000 entities, and I racked up no more than 1000-2000 tris on average. I set the highest level of LOD (objLOD_2) as a sprite to cut down on the number of tris rendered.
Also, how do you create the code boxes? I have no idea! Thanks. :)
I've been programming since I was a little kid (I'm 24 now), but I'm quite new to working with 3D. This morning I was working on some Level-Of-Detail code for a game I'm planning, and this is what I came up with:
Type obj_data Field obj ; Object centre Field obj_scale# ; Scale of object Field range_near ; 'Near' range Field range_far ; 'Far' range Field objLOD_0 ; Closest object Field objLOD_1 ; Mid-range object Field objLOD_2 ; Distant object Field LOD2_visible ; Override the checking on LOD2 visibility End Type ......... insert code here Function check_LOD(temp.obj_data, cam_temp) Local dist = 0 dist = EntityDistance(cam_temp, temp\obj) If dist < test\range_near Then ShowEntity temp\objLOD_0 HideEntity temp\objLOD_1 If temp\LOD2_visible = False Then HideEntity temp\objLOD_2 ; If LOD2 visibility is true, never hide entity End If If dist >= test\range_near And dist < test\range_far Then HideEntity temp\objLOD_0 ShowEntity temp\objLOD_1 If temp\LOD2_visible = False Then HideEntity temp\objLOD_2 ; If LOD2 visibility is true, never hide entity End If If dist >= test\range_far Then HideEntity temp\objLOD_0 HideEntity temp\objLOD_1 ShowEntity temp\objLOD_2 ; No checking here, always visible at this range End If End Function
Opinions? Any way I can improve on this? At the moment it's not too bad. I created a random 'galaxy' with 5000 entities, and I racked up no more than 1000-2000 tris on average. I set the highest level of LOD (objLOD_2) as a sprite to cut down on the number of tris rendered.
Also, how do you create the code boxes? I have no idea! Thanks. :)
