Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
Saturn 7 - Level of detail (LOD's)

Robo
Guest
Quote
2021-01-02 03:40:43

Hey guys, I have a nice video here showing how I coded my level of detail (LOD) which is very important for outdoor terrains.
(indoor can just hide whole rooms etc)

See my other post in the 'Programming' section for more info.

https://www.youtube.com/watch?v=AX8XTW1pm2c


GolOO
Guest
Quote
2021-01-02 13:02:13

Nice work, Robo!
Please tell me how you made the fps counter on the screen.


marcw
Registered User
Quote
2021-01-02 23:34:05

Robo, thank you for having published this video tutorial to explain your very nice LOD project.

I think it could also be useful to modify the textures of the targeted object : one having a high resolution if the player is not far from it and other ones having lower resolutions if the player is far enough.




Robo
Guest
Quote
2021-01-03 00:03:51

GolOO wrote:
Nice work, Robo!
Please tell me how you made the fps counter on the screen.

Its a behavior you attach to a 2D overlay - I adjusted an existing one to run twice a second:


// This Coppercube behavior must be attached to a 2D Overlay2, where it will show the FPS.
// Origional : Isaac Sukin

/*
<behavior jsname="behavior_FPS" description="FPS counter">
</behavior>
*/

behavior_FPS = function() {
this.fps = 60;
this.framesThisSecond = 0;
this.lastFpsUpdate = 0;
};

behavior_FPS.prototype.onAnimate = function(n, timeMs) {
if (timeMs > this.lastFpsUpdate + 500) {
// update twice every second
this.fps = (0.5 * this.framesThisSecond * 2) + 0.5 * this.fps; // compute the new FPS
ccbSetSceneNodeProperty(n, "Text", this.fps.toFixed(0));
// reset counter till next update
this.lastFpsUpdate = timeMs;
this.framesThisSecond = 0;
}
this.framesThisSecond++;
}


Robo
Guest
Quote
2021-01-03 00:07:03

wrote:
Robo, thank you for having published this video tutorial to explain your very nice LOD project.

I think it could also be useful to modify the textures of the targeted object : one having a high resolution if the player is not far from it and other ones having lower resolutions if the player is far enough.


cheers, thanks.
CopperCube uses mipmaps that adjust texture sizes automatically according to distance so no need for that I don't think but you could specify the maximum texture size the mipmaps will use depending on memory available - I have this in my game menu.


GolOO
Guest
Quote
2021-01-03 11:28:27

Robo wrote:
GolOO wrote:
Nice work, Robo!
Please tell me how you made the fps counter on the screen.

Its a behavior you attach to a 2D overlay - I adjusted an existing one to run twice a second:


// This Coppercube behavior must be attached to a 2D Overlay2, where it will show the FPS.
// Origional : Isaac Sukin

/*
<behavior jsname="behavior_FPS" description="FPS counter">
</behavior>
*/

behavior_FPS = function() {
this.fps = 60;
this.framesThisSecond = 0;
this.lastFpsUpdate = 0;
};

behavior_FPS.prototype.onAnimate = function(n, timeMs) {
if (timeMs > this.lastFpsUpdate + 500) {
// update twice every second
this.fps = (0.5 * this.framesThisSecond * 2) + 0.5 * this.fps; // compute the new FPS
ccbSetSceneNodeProperty(n, "Text", this.fps.toFixed(0));
// reset counter till next update
this.lastFpsUpdate = timeMs;
this.framesThisSecond = 0;
}
this.framesThisSecond++;
}



Thank you very much, Robo!





yalazkan
Registered User
Quote
2021-01-03 12:05:48

Very nice job robo :)
But, first of all save your eyes...
NEVER use a white background while coding..
NEVER use small fonts, too....
So, try to use notepad++ or something else instead of CC's own script editor.
Yes i know it is a damned work to save and reload your code every time when you add a single dot, but it is the only way to save your eyes....


csp-games
Guest
Quote
2021-02-03 23:46:23

couldn't agree more. also, js syntax coloring, acting as visual typo detector etc. saves your energy, you can concentrate more and longer.
https://notepad-plus-plus.org/downloads/


Robo
Guest
Quote
2021-02-04 08:10:08

wrote:
Very nice job robo :)
But, first of all save your eyes...
NEVER use a white background while coding..
NEVER use small fonts, too....
So, try to use notepad++ or something else instead of CC's own script editor.
Yes i know it is a damned work to save and reload your code every time when you add a single dot, but it is the only way to save your eyes....


good advice - thanks.
Yes, I do use Notepad++ actually - I shouldn't use white backgrounds true enough.....eat lots carrots for ur eyes :)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (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