Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > CopperCube Open discussion
Extended Javascript API and Showcase

Alireza
Guest
Quote
2022-07-20 14:50:01

https://doc.babylonjs.com/img/playgroundsAndNMEs/divingDeeperPBRMaster5.jpg


just_in_case
Moderator
Quote
2022-07-20 19:06:54

@Alireza, you can already do something like this by combining my light shader with ccbRenderToTexture() API.

Also, I just added another API command for Animations, I think this command is going to save a lot of time in setting up animations in CopperCube.

Hope I will add more to the API, and by the end of this month I will submit my modified file to @niko, so that he can make them into the final release.


Robo
Guest
Quote
2022-07-21 07:47:28

Your doing some really important work 'just_in_case' - thanks and keep going !

I just bought your shader for $20 - I recommend others also to support your work which will re-invigorate CopperCube game engine.

Cheers.
Robo


just_in_case
Moderator
Quote
2022-07-21 13:08:53

Thanks a lot, @robo for the purchase, it will go in the domain renewal of Neophyte.cf which is going to expire in next month.

I am trying to explore and implement things, I also have implemented an API that allows us to animate (move, rotate or scale) any animated joint during the runtime, it is still WIP, the only issue I am having is it resets the animation when you alter the bone, I am thinking of a workaround for this.
This API, will allows us to created head bobbing, like auto rotate the head toward another node, or towards camera, and will help in IK, and FK for animated joints. It will make climbing and other stuff more realistic.

Hope,I will figure out a way to fix the animation reset issue.


just_in_case
Moderator
Quote
2022-07-22 06:43:51

Continuation of Original Post 1

 ccbSetCurrentAnimationFrame(animatednode, framenumber)
Allows you to set the current animation to be played from a different animation frame.

 ccbSetGameTimerSpeed(speed) 
Allows you to set the speed of the game timer speed, You can use this to create slow motion effects and more, the Default speed is 1.0

  ccbEmulateKey(keycode, Presseddown) 
Allows you to emulate any key, and can be used to create virtual input for 2D overlays, 2Dtouchinput only provides emulation to a small number of keys. Also, 2Dtouchinput has issues with scaling and positioning on webGL, So this API might be more useful.

 ccbGetAnimatedJointPosition(AnimatedMesh, JointIndex) 
returns the position of the animatedjoint can be used in many situations like getting more precised collision detection and other stuff, can be used to fix trailing of attached child nodes to animated joint

2023 additions

ccbGetSceneNodeParent(node)
returns the parent node of a scenenode.

Fiddled with some more Things like Orthographic view, Skydome, animated joint, etc, but I am having some sort of issues with them, So they are probably on hold.
They all work, but I don't know how to implement them correctly so that it will be easier to use them with the API.

Fixed some bugs, previously RenderToTexture was causing out-of-video memory issues when used with onFrameEvent(), it is fixed now. Also, it was setting the background color to a different value previously, which is also fixed now.


Robo
Guest
Quote
2022-07-25 08:29:43

Some great additions to come (hopefully).

How about something like "ccbGetPhysicsCollision" - to find whether a node has collided with something and by how much force ?

This way we could detect collisions and maybe play the appropriate collision sound and volume and use that for other checks also ?


just_in_case
Moderator
Quote
2022-07-25 10:36:27

Hi @Robo, since Last 2 Days, I got myself involved with the Shader Issue, and I know why there is that issue, however there is nothing wrong with the shader code and maths. The reason why normal maps, don't react to light is that CC, doesn't provide pre-computed TANGENT, and BITANGENT(BINORMAL) to the HLSL shaders, and that's where the issue, arises. and tobe honest my skills are not that great that I can compute the Tangent and Bitangent on my own, Still I tried to calculate the Tangent and it works, but sometimes lights get inverted. It would have been much easy if CC provided pre-computed Tangents at least, Bitangents are simply the cross product of the normal and tangent. Or maybe I am calculating the normal and tangent in wrong space, but I don't think so. Hope I will find a fix soon.

Regardig the ccbGetPhysicsCollision, I haven't yet involved myself with the Collision detection in C++ source. It seems too complicated to me, but I will try to do something like this, or maybe I can create an API, that will give us the absolute positon of animted joints, So that we can create a for loop for the joint and can check if they have collided with bounding box of a scenenode or with the world, maybe that can help.

Edit:- I was too silly, Finally I fixed the Normal Mapping with the shader it will be updated soon enough, it was just one value that was messing me from the last 2 days. Hahaha finally relieved that it is fixed now, I can focus on the C++ part again.

Edit2:- There are still some issues with normal maps, update is revoked.


just_in_case
Moderator
Quote
2022-07-28 17:40:52

Do you guys think that it will be good to have a Game Pause API, that will pause the game for a specified amount of time?


onceforloops
Registered User
Quote
2022-07-28 17:53:34

I am looking forward to utilizing the new API. This is really awesome JustInCase:)


Robo
Guest
Quote
2022-07-30 03:29:39

wrote:
Do you guys think that it will be good to have a Game Pause API, that will pause the game for a specified amount of time?


a pause fot time period dont think would be very much needed but pause game (on/off) would be cool...


just_in_case
Moderator
Quote
2022-07-31 05:47:23

yeah, I also think the same, the reason I asked for this is that, there is already a Sleedp function in CC that allows us to pause the game for a specific time, maybe we can use this to create a pause and play, a mechanism like we can put a huge amount of time for the pause, also this sleep function can be interrupted so I think we can utilize it.
I am also thinking to release my Fake PBR shader, already created a draft page on itch.io
I was looking for some 3D models to try the shader on, so that I can pack them as demos for the shader.

Also, I am thinking of creating custom scenenodes for CC but it is hard to test them without having the editor source, you can't really debug the code without having the source code, for example when you edit or add new attributes to any scenenode, you can't check if they are actually added or not, the debug don't throw any error but I don't see any changes either so it's a bit hard to debug and create features that way.


onceforloops
Registered User
Quote
2022-07-31 14:12:21

You do an excellent job JustInCase:)
We are all very fortunate to have you as a moderator.
Glad you got your gpu going again, I'm really looking forward to the new API and the PBR Shader.


Robo
Guest
Quote
2022-08-03 08:15:12

If there could be an API to allow/disallow the Directional light on specific textures would be good.

Currently only is a checkbox for 'Lighting' in Irrlicht Properties for both point lighting and Directional lighting (except when Static with normal maps).

I just wish there was 2 buttons there for Directional and Point Lighting separate as cant seem to get right the normal mapping with transparency (just doesn't work well) and so if we had both buttons would be better.

OR a new API that can achieve that maybe ?


just_in_case
Moderator
Quote
2022-08-03 10:19:08

@Robo. I have responded to your steam post regarding this topic.

I am totally unable to understand what you exactly want.

here are some keypoints to make it more clear about CC lighting.

Static Lights :- Doesn't affect a material, if is not used with calculated light maps, or normal maps.
When using normal maps they don't act as static, they can move around the scene and the material will respect the movement of light.

Dynamic Lights :- will affect the material and can be moved and the material will react to every light for the maximum supported lights whether it's Directional or Point light.

Directional light:- Doesn't work with Normal maps at all, so they don't affect the normal mapping.

The Checkbox in the irrlicht properties, only switches between dynamic lighting and none lighting, there is nothing special about that checkbox, it is same like you do when you change the lighting from the default materials tab. If you are using lightmapped textures and have changed the lighting from either the irrlicht or the default material tab. You need to do the lightmap calculation again, or you can set the lightmapped textures manually, by changing the material to lightmapped material.

As I said directional lights doesn't affect normal mapping cause they don't work on normal mapped textures, so I don't know why there is need for having that additional parameter that turns off the directional lighting, cause when you are using normal maps, it doesn't matter if the Lighting option for a directional light is On or Off.

for the normal mapping with transparency, if you are using the default materials of CC, then you probably need to vertex paint your models with the transparency, the transparency there is based on the vertex color, not on the basis of texture, so you probably need to vertex-paint your model with transparency.

Or maybe if I am not understanding it clearly, you can provide a video or a demo file with the issue so that I can understand what you exactly want, and maybe I can create a new API for it.


veganpete
Registered User
Quote
2022-08-03 12:45:25

Not sure if it's already possible but an API for adjusting global clock/timing would be handy, such as the slow motion "bullet-time" in the Matrix movie and MaxPayne game.


Create reply:


Posted by: (you are not logged in)


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