Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Check my dynamic shading on height maps - both work well together. https://youtu.be/Q_yqqJ7nDTA The code to do this easily is here: // sunlight angle var tod = ccbGetCopperCubeVariable("TOD"); // set up a variable as 'TOD' to be between 0-24 (24 hr time). tod = tod - (-0.04); if (tod > 24) { tod = 0; } ccbSetCopperCubeVariable("TOD", tod); if (tod >= 0 && tod <= 6) { var angleX = -(tod / 6); var angleY = -((tod / 6) -1); } else if (tod <= 12) { var angleX = ((tod-6) / 6) - 1; var angleY = (-tod / 6) + 1; } else if (tod <= 18) { var angleX = (tod-12) / 6; var angleY = ((tod-12) / 6) - 1; } else if (tod <= 24) { var angleX = -((tod-18) / 6) +1; var angleY = ((tod-18) / 6); } var sun = ccbGetSceneNodeFromName("sunLight"); // name of directional light used ccbSetSceneNodeProperty(sun, "Direction", angleX, angleY, 0.0); |
||||
|
Good work Robo! thanks for sharing. CF |
||||
|
wrote: Good work Robo! thanks for sharing. CF cheers! I settled on 384 x 384 png file size for loading the height map into CC. It produced about 220k polygons which I am fine with to use in my game and still quite large size. I had a problem using this technique in that it would cause the skybox sides to light up but if you go to irrLict Properties and uncheck the 'normalise normals' fixes that problem. |
||||
|
that's a lot of math to work out... but the outcome sure looks worth the work... good video,thanks |
||||
|
Make a video how to create a texture changer for day/night cycle. |
||||
|
wrote: that's a lot of math to work out... but the outcome sure looks worth the work... good video,thanks cheers - yes, took about 40 mins of dedicated concentration - not an easy task to work out the correct formula for each stage. after couple of errors was working nicely. The movement of the directional light through 360 degrees covers 4 main periods so broke down my 24 hours into 4 parts also. |
|