Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Level of Detail

MuTan
Guest
Quote
2020-03-31 23:53:31

Hello!

This is my biggest extension so far, to be honest.
This plugin controls the detail of your objects.
Like, when you're, for example, 40 units away from the object, it'll show you the medium detailed object.
And when you're like, for example (again), 80 units away from the object, it'll show you the lowest detail of your object.

And now gamedev newbies be like, "What this is actually for?", "Why do we need this?". Hey man, you'd need this to keep your game performance. To make it playable on low resource devices. That way, more people will play your games!

Download Link: https://gofile.io/?c=mWmQfj

For further info, i provided you a guide pdf and a demo scene as well.

P.S. This extension doesn't detect vertical distance (above & below object) at it's current state. I'll try to fix it if possible. Fow now, it wouldn't be much proble if you're making an FPS game

P.P.S. The High, Medium & Low detailed object have to be created manually with 3D Modeling software like Blender, 3DS Max, Milkshape 3D, etc.


Robert
Guest
Quote
2020-04-01 03:54:13

Awesome work MT !

Just what we need to show higher levels of detail than normal while at the same time increasing FPS.

Much appreciated!


MuTan
Guest
Quote
2020-04-01 15:31:15

Thanks!
I'm glad that my extension is useful for people ^^


yalazkan
Registered User
Quote
2020-04-01 18:39:37

Great job. thanks….


Zoo
Guest
Quote
2020-04-20 12:13:43

Man, this resolves so many issues.


MuTan
Guest
Quote
2020-04-20 20:40:44

Oh really? Thanks! I'm glad that my extension can be this helpful for everyone.


ngame
Registered User
Quote
2020-04-21 20:06:40

Cool!


MuTan
Guest
Quote
2020-05-03 03:35:00

Thanks! :D


MuTan
Guest
Quote
2020-05-21 18:25:31

New Link: http://www.mediafire.com/file/tr...


Robo
Guest
Quote
2020-12-22 13:12:51

With 64-bit access we can now use a tonne more memory, this LOD selector will allow us to show high detailed meshes up close and less detailed further away to reduce GPU overhead and thus better looking graphics and still good performance on PC / Mac.... Nice !

(before using 32 bit was a bit limited as each LOD had to be loaded into memory and thus use up the limited memory available)


marcw
Registered User
Quote
2020-12-29 23:04:43

MuTan, thank you.
You made a nice extension.

If you are interested, I share a small CCB project (created with CCB 6.3 (32-bit) where you can see how the distance between two nodes is calculated with the three coordinates X,Y and Z.

[code]// computing the distance between two objects in a 3D space
// using their X Y Z coordinates.

var c1 = ccbGetSceneNodeFromName("c1");
var c2 = ccbGetSceneNodeFromName("c2");

var pos1 = ccbGetSceneNodeProperty (c1,"Position");
var pos2 = ccbGetSceneNodeProperty (c2,"Position");

var dist_c1_c2 = Math.sqrt (Math.pow(pos2.x-pos1.x,2)+Math.pow(pos2.y-pos1.y,2)+Math.pow(pos2.z-pos1.z,2));
var dist_c1_c2 = Math.round (dist_c1_c2*10)/10;
/code]

You can find the CCB file inside this folder "Distance XYZ between two nodes" in my main CCB shared folder.

Secured and anonymouse link on my OneDrive :
https://1drv.ms/u/s!AjokN1FU3jK1...




Robo
Guest
Quote
2021-01-01 05:23:58

I made a very nice LOD system with 4 lod meshes I created in Unreal (much better than using Blender) with this:
(LODdist can be a menu item to adjust from say (5-100)

// 4 level LOD's

var reqMax = ccbGetCopperCubeVariable("LODdist");
// on screen menu (5 - 100) but saved variable is calculated: (menu / 100) * 1000 giving 50 - 1000 effective range
var reqMed = reqMax * 1.5;
var reqLow = reqMax * 2;

var len = arrLOD.length;
for(var i=0; i<len; i=i+2) {
var name = arrLOD[i];
var LOD = arrLOD[i+1];
var node0 = ccbGetSceneNodeFromName(name + "_0");
var pos = ccbGetSceneNodeProperty(node0, "Position");
var player = ccbGetSceneNodeFromName("Player1");
var mepos = ccbGetSceneNodeProperty(player, "Position");
var tmp = mepos.substract(pos);
var distance = tmp.getLength();
print("distance: " + distance.toFixed(0));

if (distance < reqMax && LOD != 3) {
var node = ccbGetSceneNodeFromName(name + "_3");
ccbSetSceneNodeProperty(node, "Visible", true);
var node = ccbGetSceneNodeFromName(name + "_2");
ccbSetSceneNodeProperty(node, "Visible", false);
var node = ccbGetSceneNodeFromName(name + "_1");
ccbSetSceneNodeProperty(node, "Visible", false);
ccbSetSceneNodeProperty(node0, "Visible", false);
arrLOD[i+1] = 3;
print("LOD_3 loaded");
}
else if (distance > reqMax && distance < reqMed && LOD != 2) {
var node = ccbGetSceneNodeFromName(name + "_2");
ccbSetSceneNodeProperty(node, "Visible", true);
var node = ccbGetSceneNodeFromName(name + "_3");
ccbSetSceneNodeProperty(node, "Visible", false);
var node = ccbGetSceneNodeFromName(name + "_1");
ccbSetSceneNodeProperty(node, "Visible", false);
ccbSetSceneNodeProperty(node0, "Visible", false);
arrLOD[i+1] = 2;
print("LOD_2 loaded");
}
else if (distance > reqMed && distance < reqLow && LOD != 1) {
var node = ccbGetSceneNodeFromName(name + "_1");
ccbSetSceneNodeProperty(node, "Visible", true);
var node = ccbGetSceneNodeFromName(name + "_2");
ccbSetSceneNodeProperty(node, "Visible", false);
var node = ccbGetSceneNodeFromName(name + "_3");
ccbSetSceneNodeProperty(node, "Visible", false);
ccbSetSceneNodeProperty(node0, "Visible", false);
arrLOD[i+1] = 1;
print("LOD_1 loaded");
}
else if (distance > reqLow && LOD != 0) {
ccbSetSceneNodeProperty(node0, "Visible", true);
var node = ccbGetSceneNodeFromName(name + "_1");
ccbSetSceneNodeProperty(node, "Visible", false);
var node = ccbGetSceneNodeFromName(name + "_2");
ccbSetSceneNodeProperty(node, "Visible", false);
var node = ccbGetSceneNodeFromName(name + "_3");
ccbSetSceneNodeProperty(node, "Visible", false);
arrLOD[i+1] = 0;
print("LOD_0 loaded");
}}


I tried using Blender but its no way near as good as using Unreal to create auto LOD's as the system they use is so much better I found...you can export as one combined mesh with 4 LOD's then open in Blender to separate out then save as one mesh to split into 4 in CC or save one at a time.


Robo
Guest
Quote
2021-01-01 05:43:05

you need to have a fixed array setup something like this:

var arrLOD = ["BE3",0];
// 2 items: name & starting LOD


marcw
Registered User
Quote
2021-01-01 19:49:07

Robo, thank you for sharing your expertise in CCB with us.

I didn't know that the Pythagorean theorem calculation was available in the builtin functions of CCB.

I take the opportunity of this comment to wish a happy and healthy new year 2021 to the members of this community and to Nikolaus Gebhardt.





Robo
Guest
Quote
2021-01-02 04:15:06

Cool - thanks marcw, all the best to you also for 2021.

Further to the topic of decimating objects without stuffing up the textures UV which will happen in Blender if your not careful, using Unreal is so much better just to get the lowest but good looking decimated object if you are starting with a high poly model.

I must have spent over 100 hours using Blender just decimating objects for CC and ignoring many with too high polygon count from Sketchfab etc but worth using Unreal to get the best looking and lowest poly count model from now on will use that instead.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internatio?al" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact