Animate the PI = 4 experiment

Page 6 of 7 Previous  1, 2, 3, 4, 5, 6, 7  Next

Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Mon Nov 18, 2019 8:38 pm

Are you sure that all of those lights are actually being used? ThreeJS has a limit on the total number of lights that can be used, and I think the default is 6. That is because lights are very expensive to handle. There is so much code used to handle them (which is in the shaders, so you don't see it) and a lot of things need to be calculated for every object that can use them (the lambert and phong matrials). You can change the light limit, but the real problem is performance. I don't think using 9 lights is an effective use of them. You shouldn't need that many. Think about using an AmbientLight, or maybe a DirectionalLight, for the overall lighting. These mimic a light source like the sun. Then add smaller lights for specific things. You should only need 1 SpotLight or PointLight per ball, ending up with only 3 lights.

Ignore textures for the balls for the moment. Try using a more advanced material such as lambert or phong and see how that works with the lighting. You should see some specular highlights on the balls, especially if you use a DirectionalLight or HemisphereLight as the main source. Those lights allow you to set the direction that the light is coming from, so you can play with that and see how it effects the balls.

I don't like the way the user has to press the space bar to make the animation work. Ideally, there would be buttons to Play, Pause, and Step. However, given the context we are planning to use this app in, you won't even have that. I could get something working to handle it, but the interactive papers are meant to be just simple animations that loop. There should be minimal user interaction apart from camera movement and the like. Stepping seemed like a good idea at the time, but probably isn't needed on this one now.

I like the markers. Simple but effective.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Tue Nov 19, 2019 7:04 pm

.
Animate the PI = 4 experiment - Page 6 Sphlit10
Yesterday’s code - festive eh? The outer spheres have been omitted to expose the light filled innards. Each sphere contained seven pointlights and two spotlights, their helpers and optional pointlight representations – tiny solid colored spheres.
 
A quick search - threejs+maximum+number+of+lights - and brief review of several discussions later I understand the general limitation. As you indicated, shaders create light in the scene –  I thought shaders was a whole other lighting option. It takes lots of registers to handle light creation/parameter requirements. The main limit is the webGL pipeline or graphics card used. If the system is overloaded by too many lights, the lights are the first to degrade/fail.

There didn’t seem to be any fixed numbers. There are different numbers for the different types of lights. With plenty of exceptions and alternatives I couldn’t follow. For example, if more lights are needed there’s something called deferred rendering; but that would require its own source code, not likely anything like you use at the Lab. Someone else mentioned the maximum number of pointlights was 6, another person said 10 or 12. No way around it.

The image below shows each ballMesh now contains three pointlights and two spotlights. I think I’ll place tiny yellow sphere buffer geometry spheres at each of the ring intersections. I cut as much as I could for the moment, you said you wanted the spheres to illuminate a portion of the track, I tried one pointlight and two spotlights and didn't like the results. These two particles are the central objects of this app, are you certain you can't spare it three pointlights. In my defense, I'm sure you realize I am a very visually oriented person.

Animate the PI = 4 experiment - Page 6 Thrand10
Today’s code. The scene has 1 ambient and 1 directional light (not counting spotlights). The helpers will be removed. You said one spotlight and one pointlight per ball plus a sun. Yikes, I couldn't do that much cutting all at once. In the image four of the seven pointlights have been removed and the rest are distributed equally around the sphere’s rolling contact great circle. Are you sure we need more cutting?

I’ve been considering your geometric pi comments, how do we not to use it? Miles said we are free to measure lengths with geometric pi, but then length doesn’t equal distance traveled along a circular path. In order to determine the true distance we must multiply the geometric length by 4/pi. The actual distance traveled depends on the objects radius of curvature. The practical matter is, as you said, finding positions on the circle, in order to do that we need geometric pi.

P.S. Added "of curvature" after radius two sentences above.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Tue Nov 19, 2019 9:22 pm

You don't want an ambient light and a directional light. They both do the same job, but in different ways. An ambient light is homogeneous. It has no direction and basically represents all directions. A directional light has a direction that it is coming from. If the ground is represented by the XZ plane, and you placed a directional light coming from 0,1,0, then it would represent midday. Usually some other angle works much better. The hemisphere light is like an ambient light but it fades from one color, representing the sky, to another color, representing the ground. Probably not what you want here.

If you find that the ambient or directional light is not enough, then play with its settings, don't add more lights. It can be helpful to connect the light properties up to DATGUI controls to get a feel for how they change the scene as you change the settings. Find what works and then set them as the default values. Then remove those controls from the menu (comment them out so they are available if you need them again).

The ambient light, whether an actual ambient or directional or hemisphere light is irrelevant, should provide enough light to see everything without other lights. This is the general light level of the scene. Get that right before using any others.

For the balls, a point light is going to give you light in both directions of travel. The light has a point and shines in all directions from that point. A spot light is a point light that also has a direction, so it is more like a torch. You might try having a low level (intensity) point light and a higher level spot light for each ball. Maybe even get rid of the spot lights if they aren't working very well. The idea of these lights, for this app, is to highlight where the balls currently are, and maybe where they are going. They are not there to see things, per se, but are about bringing attention to something.

With respect to the limit on the number of lights, this effects the code generated for the shaders. These are not custom shaders as we have generally talked about on this forum, but are ThreeJS shaders used for all rendering, and there are many of them. Everything goes through a shader. In the shader language, a variant of C in this case, you can't do some things dynamically, such as allocating variables for the light data. So Three makes you set the number of lights that you have, and it will make sure there are enough variables to store that data so that the shaders can use it. I'm not sure what happens when there are more lights than variables for them. It may take the closest ones that it can and ignore others, or it might just be first come first serve.

Also, as you say, the graphics capabilities of the system it is running on have to be dealt with too. Most graphics cards these days have plenty of room for this stuff, but some systems are not built for graphics, so they may struggle with too many lights. It is better to keep things to a minimum, rather than trying to add as much as you can. You may find that it works fine on your own computer, but you can't see a thing on others.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Thu Nov 21, 2019 7:29 pm

.
Animate the PI = 4 experiment - Page 6 Addlig10
Above a new table. The tube radius spheres are smaller than usual for variety’s sake. The lights at the spheres’ ring intersections are the octahedral vertices of the single pointlight helper.  

Adding lighting controls for the purpose of lighting optimization given a minimum of lighting. Setting up things to start with the ambient light.  

1. A track table has been added. A pale grey (0x0c0c0c) table 10*r below the track, peeking at you from the lower left hand corner. By looking straight down on the track the table surrounds it, in accord with the orthographic view. The table is far enough away that it is out of the frame for most not from-the-top images. The table serves as a light detector. It ‘registers’ the ambient light. So do the the PI = 4 tracks, as well as transparent tracks would be expected to do, i.e. very little. The table works.
 
2. Ambient. Ambient intensity, is added to the top of the control panel, varies from 0 to 100. It works. 25 is a good number at present.

3. A Color, the ambient color is a grey – again 0x0c0c0c color. It works.  The ambient color can saturate things quickly so I’ve learned how to make lower edge color box ambient color changes.

4. pt Intensity. For the pointlight.intensity. I believe it should be very low values, setting it up from 0-3 in 0.1 increments. Not yet working.

5. pt Distance. For the pointlight.distance. 0 to 10*r. Not yet working.

6. pt Color. For the pointlight.color. Not yet working, it doesn’t allow the dat gui to function.

7. Nowhere near adding the spotlight, intensity, etc.

8. I also expect I'll try a rectangle area light as an alternative to the ambient light.

Adding the new controls has been more difficult than I'd expected - with small joys to go with it.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Fri Nov 22, 2019 7:09 pm

.
Animate the PI = 4 experiment - Page 6 Transt10
New light optimization controls; all except the Rect Area light folder are working properly.

Check out the great transparent tubular reflections - due to the new rect area light. Its dimensions match the table I mentioned yesterday, 11*r by 4.5*r, at 10*r above the track, keeping its helper out of view. Intensity is 5. Note the reflections on the tubes and spheres show the table 10*r below is reflecting the new light.

When all is ready, as you suggested, the first order of business will be to toss out the helpers and get the ambient light correct.

I'm stunned the new light works so well, I hope you're Ok with it. I'm almost ready to suggest tossing out both the spotlights and the ambient light.  

You may have noticed before I did yesterday, the curved track markers were wrong. The only casualty of stress testing the scene by changing r from 1 to 1.5. That problem has been corrected.

Going over the controls again seems to be working, almost everything went much more smoothly than ever.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sat Nov 23, 2019 7:27 pm

.
Animate the PI = 4 experiment - Page 6 Transt11
All the new light optimization controls are working. Hemisphere lighting is fully ready but commented out.

The sphere spotlights are removed, their biggest drawback was the fact we cannot have both forward and backward pointing spotlights – it breaks the minimum requirement.

The light controls are ready. Those spheres may be a bit too shiny. A requirement for using the rect area light was converting all the objects to a MeshStandard material. I see I need to add material controls – addressing the shininess, etc, before looking for optimum lighting.

Doh dee doh.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Nov 24, 2019 2:54 am

LongtimeAirman wrote:
The sphere spotlights are removed, their biggest drawback was the fact we cannot have both forward and backward pointing spotlights – it breaks the minimum requirement.

What requirement is that? The spot lights were to show the direction of travel, or at least that was my intention when I suggested them. I don't think there is a need to have backward facing lights, although I don't object to them either. I thought a nice mix should be able to be found. I also don't mind if they aren't used if they aren't needed.

LongtimeAirman wrote:
The light controls are ready. Those spheres may be a bit too shiny. A requirement for using the rect area light was converting all the objects to a MeshStandard material. I see I need to add material controls – addressing the shininess, etc, before looking for optimum lighting.

Why are there 2 specular highlights on the balls? Is there another light above the tubes?

It looks like the minimum value for the ambient intensity is 1. That can be a floating point value and the minimum should be 0 so you can turn it off. I see that the other lights look like they go to 0, so it is probably a mistake.

I'm not sure I like the rect light. It creates strange looking highlights on the balls.

I love MeshStandardMaterial. It really needs some special textures to make good use of it, though. A lot of my textures are designed for it, but it is also very easy to create simple ones. The difficulty is in putting them onto the objects, which requires quite a few steps. It really does bring things alive though. Worth the effort. Have a play with what you can, and we can discuss that later.

Have you put this project into GIT? Do you want me to put it into mine and give you access like the other projects? You will still be driving it, but it would allow me to create branches to show some things. Also makes it much easier for me to test it and see it in action.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sun Nov 24, 2019 12:50 pm

.
Animate the PI = 4 experiment - Page 6 Rlight10
Why are there 2 specular highlights on the balls? Is there another light above the tubes?
The image shows the rectArea light only - the ambient and sphere point lights are at zero. The variation across the three is due to different rectArea width and height values. Another light above the tubes? I can see the lower specular highlights as internal reflections in the tubes, but those spheres are supposed to be ‘solid’, I don’t know how to interpret the lower specular highlights which to me suggest another light below the tracks. At first I thought it was a reflection of the plane 10*r below the tracks, but that plane has not been added to this scene.

While not currently active, I thought the hemisphere light might balance the upper and lower highlights by giving them different colors.

I suppose I should add a rectArea light position control before jumping to any conclusions.

It looks like the minimum value for the ambient intensity is 1. That can be a floating point value and the minimum should be 0 so you can turn it off. I see that the other lights look like they go to 0, so it is probably a mistake.
Ok, ambient and the rest of the lights are now currently initialized to zero, for better control panel control. I should mention, if a pointlight distance is “set to zero the light is not attenuated”, so the distance minimum value for the pointlights is set to 0.1.

I'm not sure I like the rect light. It creates strange looking highlights on the balls.
Affirmative. I’ll include rectArea light position controls next.

I love MeshStandardMaterial. It really needs some special textures to make good use of it, though. A lot of my textures are designed for it, but it is also very easy to create simple ones. The difficulty is in putting them onto the objects, which requires quite a few steps. It really does bring things alive though. Worth the effort. Have a play with what you can, and we can discuss that later.
The tubes are transparent and do not seem to be affected by meshStandard material roughness or metalness. So I changed the control panel material object from track to red marker without having changed out the word track yet. The spheres and the markers are the only opaque solids, the only objects that could possibly benefit by a texture.  

Have you put this project into GIT? Do you want me to put it into mine and give you access like the other projects? You will still be driving it, but it would allow me to create branches to show some things. Also makes it much easier for me to test it and see it in action.
No Sir, I have not put this project into a GIT folder. I’d greatly appreciate you handling it like your other projects.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Nov 24, 2019 5:43 pm

Now that I think about it, it does make more sense that the light in above the scene, not sure why I was thinking that it was below (maybe because that is where the table was a few posts ago).

I would not expect to see any reflections of light from other objects in the scene. That is extremely expensive to calculate. There are ways to do such things, but I would not expect ThreeJS to provide those. I once read a great article about the way the game Metal Gear Solid V does this and it required many rendering passes and various temporary images to be generated. Basically, a highly customized rendering pipeline. This could be done in ThreeJS too, but is beyond the scope of ThreeJS to provide (I imagine, anyway). Interestingly, the new big thing in graphics cards is all about this (called ray-tracing), but you need dedicated hardware to do it (that's how expensive it is to calculate) and only the most expensive cards have it at the moment. I am unaware of ThreeJS supporting that yet, and wouldn't expect it for some time.

Airman wrote:
Ok, ambient and the rest of the lights are now currently initialized to zero, for better control panel control. I should mention, if a pointlight distance is “set to zero the light is not attenuated”, so the distance minimum value for the pointlights is set to 0.1.

I didn't mean to initialize them to 0, just for the UI control to allow the user to drop it all the way down to 0.

Using 0.1 as the minimum point light distance is fine.

Airman wrote:
The tubes are transparent and do not seem to be affected by meshStandard material roughness or metalness. So I changed the control panel material object from track to red marker without having changed out the word track yet. The spheres and the markers are the only opaque solids, the only objects that could possibly benefit by a texture.

In order to use metalness and roughness, you need to supply special textures that provide that information, one for each. You set the textures on the metalnessMap and roughnessMap properties, then you can alter the metalness and roughness values (floating point values between 0 and 1 inclusive) to determine how much impact those textures have.

The tubes can still benefit from some textures. I'm not saying they actually need them, but there can be benefits from using them. For example, using some amount of roughness would alter the light upon the tubes, potentially making it look more like PVC.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sun Nov 24, 2019 7:11 pm

.
Animate the PI = 4 experiment - Page 6 Rlight11
Here’s a view of the latest rectArea light control including position and rotation, along with the helper which is a bright white square when viewed from the other side. The helper isn't changing dimensions with width or height changes - I may need to include an update(?), but the light does change correctly. A little bit of rectArea light can do a lot.

The straight track white pi marker is still transparent and so the backside on the other side of the tube is obscured.

My hemisphere light is gone, must have been lost during the great spotlight purge a day or two ago, I’ll do it again.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Mon Nov 25, 2019 7:04 pm

.
Animate the PI = 4 experiment - Page 6 Objcon10
Adding a fine light source alternative, Directional lighting – from the top right in the scene above, along with material controls for all scene objects. At present I’m working on adding the directional light target coordinates control. Everything is going well – knock wood.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Tue Nov 26, 2019 12:13 am

Try slerping the colors on the markers, while still using the same color for each corresponding part of each track. I'd like to see some way of quickly identifying the correlation between the track positions. you might have trouble since 2 markers on the curve are in the same position. It would be awesome if those 2 actually changed color depending on whether the ball had passed that point or not.

Slerping works by changing one color into another color based on a value between 0 and 1 inclusive. So use the distance along the track, divided by the length of the track, to set that value. Then you just need to pick 2 colors to vary between, or 2 shades of 1 color, or a single color slerped from white, or something like that.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Wed Nov 27, 2019 6:24 pm

.
Animate the PI = 4 experiment - Page 6 Withta10
Try slerping the colors on the markers… It would be awesome if those 2 actually changed color depending on whether the ball had passed that point or not.
I agree, this can be the Flaming Hoop option. If so, I’m going down, worse, without the flames. Searching on threejs+slerping+colors I get no overlap except for a hidden note someone left on the threejs color page, https://threejs.org/docs/#api/en/math/Color, “add slerp”. Do you have any reference you could share? There's real problem here. If slerp isn’t a coloring option, what is? How can I change an object’s color during an animation? The only answer I can find involves tween.js.

https://stackoverflow.com/questions/12504449/how-to-tween-between-two-colours-using-three-js
https://stackoverflow.com/questions/22506406/three-js-animate-a-mesh-with-color-transition-tween-js

Slerp – spherical linear interpolation - is always described as a quaternion operation involving an initial position (and possibly a rotation) and final position (and rotation). https://en.wikipedia.org/wiki/Slerp. Slerp is all about quaternions. I gather that if one defines beginning and end quaternions, one may slerp any number of linear interpolations between the two end positions. As you suggested weeks ago, one could describe a complete circular path about a point using slerp - quaternions. I wasn’t able to find a quaternion solution and used the parametric form instead. Is that what this is about? Do you still object to the parametric equation r = rcosθ + rsinθ and are leading me down the quaternion path?

Geometric pi divides the curved path into equal lengths. Please consider the following reference, the Wikipedia link above includes it in its list of references.
The Inner Product, April 2004. Jonathan Blow (jon@number-none.com). Last updated 26 February 2004. Understanding Slerp, Then Not Using It
http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/
Coordinate-free derivation of slerp

Our inputs are two unit vectors, v0 and v1, and a scalar t.  We are solving for a vector r whose angle with v0 is θ = t θ0, where θ0 is the angle between v0 and v1.

Figure 1 illustrates the problem.  I have drawn v0 in the direction we usually use for the X axis when drawing the XY plane.  This by itself suggests a solution.  If we had some vector v2 that was orthogonal to v0, as the Y axis is to the X, then our solution r = v0cosθ + v2sinθ.

Assume our input v1 is linearly independent from v0.  (If it isn’t, then the entire slerp problem is ill-formed; robust implementations of slerp contain a preamble to handle this case).  Since v0 and v1 are independent, we can orthonormalize v1 against v0 to yield v2; see Figure 2.  That’s it, we’re basically done!  The rest is implementation details, like finding θ0 from v0 and v1.  Listing 1 contains pseudocode for the whole function.  That’s slerp; slerp is not some scary 4-dimensional thing.  Listing 2 contains actual C++ source code.  Though this code is written specifically for some type called a Quaternion, it is valid for vectors represented in an arbitrary number of dimensions; so if you have some dynamic n-dimensional vector class, you can just plug in the same source code.  (Perhaps you want to interpolate surface normals on the unit sphere in R3).
As I understand it, the initial and final positions should be independent. If they were not independent – like the hands on a clock or postioning the sphere on the PI=4 track, the linear interpolation simplifies to the parametric form, making the quaternions gratudinous(?). Anyway, if so, I’ll try to comply. Come to think of it, I believe you might have used a quaterion placement example positioning spheres in the Hosohedron configurations. Or would the following approach to incrementally advancing the sphere around the circular path acceptable?
360-degree-quaternion-interpolation
https://gamedev.stackexchange.com/questions/117726/360-degree-quaternion-interpolation
It doesn’t really explain and sure it’s broken somewhere but being optimistic I wouldn’t expect that to be an issue.

Thank you Sir, I cloned the bitBucket PI=4 repository, added a public_html copy of my piEqFour project files and Pushed them back to bitBucket. What do you think? What other docs are needed? How are we going to use this platform in creating interactive papers? By the way, I expect to be otherwise busy here over the next couple of days. Being on another side of the planet, I hope you don’t mind my saying, Happy Thanksgiving.  
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Wed Nov 27, 2019 8:14 pm

My bad. I didn't actually mean slerp, I was thinking of lerp, but knew that colors are different and have to be treated differently to get reasonable results. I jumped onto the slerp term but that is for angles, as you point out.

The actual function you want is lerpHSL. The THREE.Color class has both lerp and lerpHSL, but the latter one works better. It really depends on the actual colors you are lerping, but in general, lerpHSL will transition through all colors in a better way than the lerp function.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sat Nov 30, 2019 8:00 pm

.
Animate the PI = 4 experiment - Page 6 Sortal10
Mostly back to work. Above, a sequence of 15 images showing the balls crossing their starting markers. The straight track's marker colors are changing color per Hsl lerping.
 
How nice, I created my first color animation using the track’s table, all those flashing lights made me think of the eighty's. I was then able to code two different straight track lerps, toward and away from the track markers, and within proximity of the ball’s radius as shown in the series above. The total track time is 19 sec for 10*r. bRadius is 0.175*r. The color sequence is not the red to green toward the marker, and green to red going away from the marker as I had intended. There are way more colors present but they do seem to match going toward as going away. Colors sure add a whole new dimension of complexity to things, I’d need to work with them for quite some time before I feel the least be confident.

I can't say it's an awesome change, if I can get these marker colors right, it would amount to a nice touch. It's difficult to see the markers changing colors unless one views the scene up close and advances the scene frame by frame. To make the color change more noticeable changes would be necessary. Flames may not be enough, how about larger, or discreetly exploding/expanding/fading rings?

I don't know that there needs to be any additional animations or not.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sat Nov 30, 2019 8:54 pm

I didn't mean for the each marker to be dynamically changing color. I just meant for each marker to be advancing from the last one. The color varies across the set of markers, for a given track, and match the other track so that the user can immediately see which markers represent the same distance along each track.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Mon Dec 02, 2019 7:26 pm

.
Animate the PI = 4 experiment - Page 6 Colorm10
I think your suggestion is working out well, at least according to my latest working interpretation/solution; that is, until you make any additional necessary suggestions.

When the balls are in their starting locations, the straight track marker colors are: magenta, dark blue, light blue, green, yellow, white (the 2xpi(g) marker) and finally red.

The initial curved track markers are in the same order but without either the white (pi(g)) or final red marker colors.

As the balls pass the first magenta markers those markers are hsl-lerping through the same various colors while the balls are within a ball radius of their markers. The lerping may not be real clear, but the flickering does grab one's attention. After the ball passes an additional ball radius away, both magenta makers turn black.

As the balls pass within a ball radius of the dark blue markers the makers begin hsl-lerping. On the straight track, after the ball travels another ball radius the dark blue marker it is turned black. On the curved track, when the ball enters the curve, the dark blue marker turns red.

Again and again as the balls pass the markers, they hsl-lerp until they stop, then turn black.

When both balls pass through the final red - now lerping marker, all the initial marker colors are restored.

The ball/marker interaction, including shutting down the past makers makes it very easy to ‘correlate’ the motions of the two balls in both tracks.

Everything is working up to the point shown above – I’m entering the curve.  
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Tue Dec 03, 2019 7:28 pm

.
Animate the PI = 4 experiment - Page 6 Endmar10
At today's photo finish, only the spheres and final markers are well lit.

The markers are behaving close to the animation I described yesterday. No surprise, as you anticipated, that curved track start/final marker was going to give me a problem, two different markers must occupy the same world space. Well I haven't solved that one yet, the consequence is fairly minor. Only the circular track's final (start(?)) marker does not lerp - all the other curved and straight track marker animations are working properly. The final color in the straight track's final lerp sequence is red, and so we still have a matching photo finish.

I had another, more significant problem which you’ve anticipated and I must describe. The curved and straight track markers were not quite synchronized. Compared to the straight track markers, the curved track markers took a slightly longer amount of time – more frames – to lerp as well as turn to black. The difference between the tracks was clearly distracting and unsatisfactory. Based on previous experience on this project I quickly came up with the ‘correct’ solution. I think I even almost understand it, an aspect of circular motion. I narrowed the ball’s angular width from,  

var ballWidthAngle = 2*Math.asin( bRadius/r );

to

var ballWidthAngle = (Math.PI/4)*2*Math.asin( bRadius/r );  

Both tracks now lerp colors and change to black on the same frames - simultaneously.  
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Wed Dec 04, 2019 10:48 pm

.
Animate the PI = 4 experiment - Page 6 Endmar11
The PI=4 Experiment, including transparent tubes, lighting and marker color animations are working properly and looking good; clean and elegant. Your ideas have pushed this project well past my expectations. Thanks boss.
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Thu Dec 05, 2019 10:33 am

.
I believe this project is ready to compliment one of Miles' PI papers, do you agree?

You asked me to think about which one. I suggest adding it to the end of Miles’ most recent PI paper, A Simple Experiment Proves Proof Pi=4. Once that’s complete, and the animation is available for review by others, we might ask Miles and StevenO what they think.

Does that sound like a plan?
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Fri Dec 06, 2019 7:29 pm

.
Animate the PI = 4 experiment - Page 6 Endmar12
Consider this latest change.

As we know, if the curved track were straightened out and laid against the straight track, it would be as long as the straight track 2*PI marker; which, according to now out moded conventional geometric theory, is where the straight track ball should be at when the ball in the circular track completes the circle. Given circular motion, we now know that the distance traveled by the ball in the circular path will 4/PI(g) longer.

Of course nothing special happens when the straight track ball reaches the 2*PI marker. As such, I suppose it’s appropriate, indicating the ‘extinction’ aspect geometric pi. On the other hand, if there’s a straight path 2*PI marker, why is there not one on the curve, showing where the curved path ball actually is at that moment?

The straight track 2*PI marker stands alone till it is passed by. In my mind, adding a curved track marker in the same place adds balance. Like using two apostrophes instead of one. I would not use the curved path 2*PI marker as an illustration of the A Simple Experiment Proves PI = 4 paper. I would try to match StevenO’s layout as much as possible. A lot of subjective choices are unavoidable, requiring agreement and coordination.

Please redirect me as you see fit. I’m still trying to add a dat gui pull down option. Of course it isn't needed for a single paper illustration. The current project includes all the bells, whistles and extra sinks. Any illustration would begin with a sharp reduction in source files – say as to match StevenO’s experiment as closely as possible.

I’ll keep busy. I also want to be able to change cameras. A few more things. Please let me know if there are any problems.  
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Dec 08, 2019 1:12 am

It's looking pretty good. I think the ball and track diameter is too small. The camera is not centered at the start. The view should be from directly above.

It is currently implemented as a full screen app, but it will not be used as such in an interactive paper. It will be much smaller, so this needs to be thought about. You probably can't do too much until it is put into the paper, where you can actually judge it, but just think about it only using the center half of the screen and make sure that things are still easily visible.

As far as code goes, it will be much easier to put it into another page if all of the code is in a JS file, and not in the HTML file. You can leave ThreeJS setup code in there, but try to get all PI=4 specific code into a JS file. Then it can be included into another page easily, and how it fits into that page is separated from your stuff. I will need to juggle a few things to fit into my interactive paper code and this will make it easier to do so.

I wasn't sure what some of the menu items were supposed to do, and playing with them didn't seem to change much, but it did create errors. The balls got out of sync with each other at one stage, just from checking and unchecking some check-boxes. That shouldn't be possible. It might not be a problem in the final product, because those menu items won't be in there, but it is good to think about those sorts of things anyway.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Dec 08, 2019 1:17 am

From a physics standpoint, the ball on the curved track obviously slows down once it reaches the curve. Is that a problem, or is it expected? I must say that it is messing with my brain and makes me doubt this hypothesis. Maybe it would be worth while having a second curved track where the ball moves at PI=3.14 for comparison. We might not use it in the final product, but it may be useful for our own analysis.
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by LongtimeAirman on Sun Dec 08, 2019 7:07 pm

.
Animate the PI = 4 experiment - Page 6 Gtrack10
The current initial output view – including the ortho camera helper.

The ball radii and track diameters have been increased. For the record, StevenO's experiment included a 17.6cm diameter circular track traversed by 12mm diameter balls. 1/X = 1(17.6/1.2) = 1(14.6666). x = 0.0681818cm. The balls in the animation image above are now twice that, bRadius = 0.136363*r. No problem, the larger diameter tracks are easier to see. Unfortunately, StevenO’s experiment didn’t include spins, but I want people to see the spins. Do you agree? Is it right or wrong to include the spins? Would using spins with caveats suffice?

Is the above properly centered (ignoring the new pi(g) track) ? Given a 50% smaller canvas, I tried to ‘enlarge’ the camera view, but that resulted in too much track front edge clipping; I ended up restoring the camera view size.

I’ve tried converting to a smaller canvas in the html style block. The “title” and info went to the top left of the larger browser screen area. It was partially covered by the stats also at the top left. The dat.gui was at the top right - outside the canvas. They would all need to go. I’ll follow the format you come up with.

Some of the material controls are there just for the links or structure’s sake, to add to or modify as desired. I was happy the dat.gui controls went so well (minus the pull-down), I was ready to try and control everything.

Changing pi(k) and pi(g) are something else. I thought the pi switch worked sufficiently well when I switched either the numerator or denominator pi switches once in a given track run; switch them twice and the tracks are unsynchronized.

Let me qualify that, the tracks are each in their own separate animation loops, they are synchronized or they aren’t. I don’t have any code to ensure the tracks are synchronized. I suppose I’ll try to correct that. I think I’ll try including boolean readyS, readyC, and readyG variables such that balls will not be advanced until all tracks are completed and again ready. Hopefully my current if/else structure will allow it.

Ask for a separate pi(g) track and ye shall receive. It’s a pig, not operating completely correctly – I haven’t converted all the spin animations and lerping yet. The tracks are ‘synchronized’ since the ball pi(g) track is allowed to overrun. All three begin new runs simultaneously, I’m not sure how. Maybe with ready variables the pi switches will work properly for the curved track; alternatively, since we now have a separate pi(g) track, it may make more sense to isolate the pi switches to just that track.  
.

LongtimeAirman
Admin

Posts : 1433
Join date : 2014-08-10

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Nevyn on Sun Dec 08, 2019 11:31 pm

Don't worry about trying to make the canvas smaller. That won't matter, although it is useful for you to test it, I guess. Basically, it is the contents of the scene that matter. The camera especially, as that sets the view. So make the scene work at whatever size you have, even full screen, but things might look a bit larger than you would actually have them at that size (assuming full screen). Make sure that the tracks take up almost all of the available space. The straight track should be about 90% of the width. Assume the height will be smaller than the width, probably in a 16:9 ratio (width:height). Set the track and ball diameter to use as much of that space as you can without it looking strange.

I would expect the tracks to be in the same animation loop and coordinated such that they stay in sync with each other. If some action causes a reset, then all tracks must be reset. They should be using the same time mechanism and a reset just changes that time. Then everything remains in sync no matter what happens. I assume that all tracks run through the same function that contains the if/else structure for motion (although they would be executed separately, so maybe that's what you meant by not running in the same animation loop). When you say animation loop I assume you mean the application loop, executed by the requestAnimationFrame function.

Can you make the PI=3.14 track a mirror of the PI=4 curved track, and place it on the other side of the straight track? I'd prefer the balls to start at the same X position (assuming X represents the width) so that you can see that they are moving at the same velocity during the straight section at the start. It will look a bit phallic, but the 6 year old boy inside of us can have a giggle and then get back to work. Very Happy
Nevyn
Nevyn
Admin

Posts : 1773
Join date : 2014-09-11
Location : Australia

http://www.nevyns-lab.com

Back to top Go down

Animate the PI = 4 experiment - Page 6 Empty Re: Animate the PI = 4 experiment

Post by Sponsored content


Sponsored content


Back to top Go down

Page 6 of 7 Previous  1, 2, 3, 4, 5, 6, 7  Next

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum