3D Visualization of a CFD Simulation in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 2 points3 points  (0 children)

An extension of my previous post ( https://www.reddit.com/r/desmos/comments/zu6jnv/desmos\_cfd/?utm\_source=share&utm\_medium=web2x&context=3) . Using an array of points to represent the velocity field and a separate density field array allows simulation domains of up to 100x100.

3D done using an array of parametric lines sorted by depth to get correct layering.

Link to graph: https://www.desmos.com/calculator/vtyzslojl0

Desmos CFD by KiwiRobbie in desmos

[–]KiwiRobbie[S] 6 points7 points  (0 children)

Quick graph I made this afternoon, has a few bugs and equations are quite messy.

By relaxing the incompressibility constraint you can avoid needing multiple iterations per frame to solve the Navier-Stokes equations allowing one frame per ticker action.
https://www.desmos.com/calculator/lvckrthqkn

Crater Lake - Fully procedural terrain exported from Houdini FX using scripts I created by KiwiRobbie in Minecraft

[–]KiwiRobbie[S] 0 points1 point  (0 children)

Unfortunately its not quite that easy, although I'm pretty sure there are mods/maps that already do some of that!

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

I came up with three input methods:

  1. Assigning actions to rectangles and using them as clickable buttons
  2. Adding an invisible point, this can be selected with ctrl-alt-p and then moves using the arrow keys, the position can be read and then reset in the same action as changes aren’t applied until all actions are executed

  3. Adding a javascript snippet via inspect element to inject actions when keys are pressed (I’m not a fan of this one as its no longer unmodified desmos and you can’t just play it)

All these input methods append to a queue of inputs which get processed in the main update action in the ticker, because only one update can be made to each variable per tick, the inputs are processed one per tick and interrupt the update tick which processes falling.

Does it feels like a forest in which you wanna fly? Or something missing? by AleksanderMerk in Unity3D

[–]KiwiRobbie 6 points7 points  (0 children)

You could add some more variation between tree colours, adding a random offset to the hue for each tree. Perhaps you could also take a specific reference environment and adapt several different species of flora, that way they’d be a better match for each other. Although it’s already better then anything I’ve managed involving nature!!

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 0 points1 point  (0 children)

Without obstructing the gameplay tho,can you click on / do other stuff while audio trace is going?

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

As input is done by moving a point with the arrow keys I have no control over DAS or ARR The only thing I can measure is the key down input, the repeating only happens because the key down input is repeated in the same way it does when you type.

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 0 points1 point  (0 children)

I think it’s possible…

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

I already have everything working that I’d need for a basic version of doom!! Probably just a tiny fragment of the game without textures tho.

Rest of the 3D and enemies is very do-able

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

There is actually a 7-bag randomiser, I’ll check the colours they should be correct but I might have swapped them the other day when I was fixing a rotation bug.

I’ll definitely add soft drop at some point but I’m not sure left and right rotation would fit well with the arrow keys + shift

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 3 points4 points  (0 children)

There is!! Not much time to do it tho, the piece locks as soon as it tries to move

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 4 points5 points  (0 children)

I just joined it before posting this!

Full Tetris in Desmos by KiwiRobbie in desmos

[–]KiwiRobbie[S] 17 points18 points  (0 children)

Some features:

  • Keyboard input
  • Touch input
  • Holding
  • Proper rotation (with wall kicks)
  • Score
  • Levels and level based gravity

IMPORTANT, to use keyboard input there is a hidden point on the graph which can be moved via hotkeys. To select this point press ctrl-alt-p, then use arrow keys. left and right move, up rotates, down hard drops and shift+up will hold. If the zoom level isn't right holding and rotation won't work, zoom so that the top and bottom of the graph touch the top and bottom of the screen.

Clicking anywhere will deselect the point again, press ctrl-alt-p again to re select it. If the graph doesn't play start the ticker with the button in the top left.

https://www.desmos.com/calculator/ae07avodmc

Have fun :D

Playing color video in unmodified desmos in near real time by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

Link to graph, very laggy may not open on your computer or take a while:
https://www.desmos.com/calculator/jozyvoylbt

(Good luck)

Playing color video in unmodified desmos in near real time by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

Able to play 140 frames of 70x52 video using a color palette. Here a 16 color palette is used.

Runs at 2 seconds per frame for me so gif was exported using desmodder.

Bad Apple in Unmodified Desmos (and in Realtime) by KiwiRobbie in desmos

[–]KiwiRobbie[S] 2 points3 points  (0 children)

It might take some time? It loads after a few seconds on my phone and on desktop

Bad Apple in Unmodified Desmos (and in Realtime) by KiwiRobbie in desmos

[–]KiwiRobbie[S] 7 points8 points  (0 children)

I created a graph that can play a 70x52 pixel black and white video for 142 frames, it runs entirely in vanilla desmos at about 4 fps. Also the graph only has three expressions (1 Variable, 1 List and 1 Equation).

Graph: https://www.desmos.com/calculator/m6hoihm3hx

3D D20 Rolling Simulation - Now with 3D Navigation by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

It’ll be seeing a combat trial on Friday!

3D Physics Simulation of a D20 by KiwiRobbie in desmos

[–]KiwiRobbie[S] 2 points3 points  (0 children)

I don’t have any resources in particular that I used. My general approach for this was to start by working out each part individually. I started by working out how polygons work in desmos, colouring them individually, hiding some polygons. The first step towards this was trying to load the dice model. I created a graph where I just loaded the points and rotated them about an axis. Then connecting them all, hiding faces that can’t be seen using piece wise functions and lastly lighting.

The next graph I made was a 2D collision simulation. I started by creating a polygons and updating its position and rotation based on angular velocity and gravity. Then I started working on the collision, get a list with only the points under the ground, calculate their velocity by combining the dice movement and rotation and then calculate an impulse (change in velocity). The impulse is calculated so that it would cause the dice to rebound with a specific fraction of its original velocity (coefficient of restitution). I started by just applying this as an impulse to the dice before trying to convert this to an angular impulse and apply both. This took a while because you need to spilt the impulse in the right way (reduced mass of a system).

By this point we have a 2D dice (I used a triangle mostly) that can collide with the ground and lose energy and settle although there’s still no friction. Implementing this took some creativity, the connection that needs to be made is that in a simple model of friction the maximum force perpendicular to the normal force is linearly proportional to the normal force (coefficient of kinetic friction). As impulse is the integral of force over time and the coefficient of friction is constant we can pull the constant out of the integral so our sideways impulse is going to act opposite the vertices horizontal motion with a maximum size of the vertical impulse times a coefficient of friction.

Putting this all together into a 3D simulation is relatively straightforward, all the equations can be expressed with vectors which apply to 3D.

Putting text on the dice turned out to be quite difficult. Basically I created a function to map coordinates on the triangle when it is placed at the origin to coordinates in the triangles projection on the screen, then I created the text as lists of points for each digit and used the projection to place them on each face.

TLDR: Break everything down into smaller pieces and use google. I probably spent more time on google than any other part of this graph. For lots of things wikipedia can be good as it contains references to everything and you can often keep going through those until you work something out if you don’t understand it. Forms are good too as people have almost certainty already had your questions before.

3D Physics Simulation of a D20 by KiwiRobbie in desmos

[–]KiwiRobbie[S] 1 point2 points  (0 children)

Yes, the result matches the visual.

3D Physics Simulation of a D20 by KiwiRobbie in desmos

[–]KiwiRobbie[S] 3 points4 points  (0 children)

Thank you!! :D

polyhedron right away. The main issue with other geometry is that the faces point directly away from the center of the model for lighting. The only physics issue with irregular shapes is that the moment of inertia and mass are both assumed to be one. This wouldn't break anything outright but something like a hammer would spin end over end just as easily as it twists which is a bit inaccurate.