(November 2018) Monthly WIP & Screenshot thread

Recent efforts have been working towards procedural coral, my first attempt is this sort of red coral :

not exactly the same as the above, but close to what I’m after :

8 Likes

I integrated the tesselation shader into PBRLighting :

makes a good use case, with a dynamically generated mesh, generating a very hi res detailed displaced mesh could be pretty nasty, so simple cylinders + tesselated detail = win.

10 Likes

Another installment of AI mobs doing semi-stupid things together:

In this case, they build the town.

Lots of stuff still left out that will have to wait. I was working on this in bits and pieces until my vacation started and I switch to other projects. This will sit and simmer on the backburner a while so that I can think about how to do the multistep scheduling necessary to properly take advantage of the stockpiles and so on.

I had originally planned to switch to a “job chooses worker” approach any might still… but it occurs to me that there are advantages to the “worker chooses job” approach and I might be able to fix the cases where it behaves really dumbly.

Most of the “stupid” in this video is because if a mob finds no job available then they will sleep for 5 seconds without checking for new jobs. This means some other mob may be ready and snatch up the job sitting right next to the guy standing around… even if guy two has to walk all the way across the board to do it.

Always choosing the best jobs for the best people is a tricky problem… even more so when you don’t necessarily know when the current jobs will end.

Edit: again, video best in hi-def.

2 Likes

Here’s a 13-second video demo of a new physics collision shape: MultiSphere!

Based on Bullet’s btMultiSphereShape class, MultiSphere it can emulate a SphereCollisionShape or CapsuleCollisionShape with added capabilities like margins, eccentricity, tapering, and non-uniform scaling. Or use it to represent exotic shapes based on the convex hull of multiple spheres.

MultiSphere is included in the open-source Minie library, which is part of my Jme3-utilities project: GitHub - stephengold/jme3-utilities: Reusable code and assets for jMonkeyEngine games (code has New BSD license)
GitHub - stephengold/Minie: Integrate Bullet Physics and V-HACD into jMonkeyEngine projects. (code has New BSD license)

Source for the demo app is at https://github.com/stephengold/jme3-utilities/blob/master/tests/src/main/java/jme3utilities/minie/test/MultiSphereDemo.java
Minie/MultiSphereDemo.java at master · stephengold/Minie · GitHub

7 Likes

is it faster than a capsule ?

1 Like

Since it’s more powerful, I’d be a little surprised if it were faster. But I haven’t benchmarked it, so I don’t really know.

It turns out that Bullet offers two different levels of detail for debug meshes. Here’s a screenshot of the same demo using the higher resolution, which yields about 2-3x as many facets per gem and gives a more accurate impression of the collision shapes.

6 Likes

Spent the last week adding shadows. Kind of dynamic baked lighting. It took me longer than I’d hoped but I’ve been putting it off for way too long. Still a bit of optimisation to do here and there, but it works as intended. It makes cave exploration that much nicer. It’s going to play well for foxes/animals digging holes/homes, night vision, animals avoiding dark/light areas, height maps for vegetation, etc… Some interesting things to play with now it’s done to keep interest flowing - which is probably the hardest task in all.

16 Likes

That’s really cool.

Just one more, this time with smoothed normals in the (hi-res) debug meshes:

8 Likes

Shadows looks good, but you have still a lot of work to do :wink: You have several common problems there.

What do you mean Bullet offers debug meshes? Last time I checked bullet itself didn’t offer any graphical debug thing at all since that really doesn’t make sense for a physics engine library. You mean normen’s debug shape renderer?

1 Like

I’m unsure whether Bullet provides graphical debug. But jme3-bullet does provide it (and so does Minie) using meshes generated by Bullet: precise ones for concave shapes and approximate ones (from btShapeHull) for convex shapes. Normen Hansen and CJ Hare are named as authors of that code.

I recently discovered that btShapeHull::buildHull() has an option to generate higher resolution meshes for convex shapes, so I created a Minie interface to access it. Those 2 screenshots demonstrate this option. It could easily be added to jme3-bullet if there’s demand for it.

PS: the buildHull() option was added to Bullet on January 11th, so it’s not in Bullet v2.87 .

1 Like

So, I’m back to working on my stuff and started by trying to get world collisions working for my mblock plugin for my mphys physics engine. (The whole point, really, eh?)

Along the way, I got really annoyed that the SimFX drop shadow renderer didn’t like odd rotations so I fixed it… and added a debug mode.

Here you can see a picture of some random block-mesh objects at odd rotations sitting on the ground (yay) with the debug mode on. The debug mode renders the shadow cube that is used to render the egg-shaped shadow volume over the existing scene.

Notice how they are kind of oblong in all the right places.

This approach would break down for sufficiently degenerate objects but then you can always add an invisible box to approximate what would be the shadow and make that the caster. (I’ve done it for other things before.) In the mean time, the approximation is pretty close for an effect that’s cheating.

Edit: another view with debug mode turned off.

You can see it’s not perfect. The chairs tipped over on their front show almost no shadow because it just happens to be that the ‘egg’ is only barely poking up through the ground. But for an effect that’s nearly free no matter how complicated your scene is… I think it’s pretty good.

7 Likes

Ok… and in the vein of “why work when you can take more screenshots?” here is another screen shot to answer the inevitable question “why shadow volumes instead of just splatting a circle on the ground?”

Here:

See the lovely way that shadow drips over the edge. In some ways, I think this is better looking than real shadows… since they’d have extended a giant smear all the way to the ground. (Note: it also handles uneven ground, etc., etc.)

Granted, there are tons of limitations, obviously, but this is one of those nice cases.

I’ve seen so many game demos where there are no shadows at all and the objects lose all presence in the world. Sometimes the difference between looking like a hobby project slammed together over the weekend and an actual game. So it’s always good to have as many shadow options as possible. And drop shadows have almost 0 performance cost and performance is often the excuse games use for not having shadows.

If you are in that boat then you can try this filter. Easy as adding it to the FPP and making sure your shadow casting objects are marked as such.

Edit: A link just in case: SimFX/DropShadowFilter.java at master · Simsilica/SimFX · GitHub

11 Likes

So conceptually, would this be kind of like putting a small light under an object and multiplying its value instead of adding it as usual?

If you got that setup in the FPP, why not just move the lights there as well and have a deferred renderer? :stuck_out_tongue:

P.S. Haven’t looked at the code yet.

I mean… kind of.

As a post-processor, it has access to the depth buffer. A regular cuboid is rendered and for each point rendered, it calculates how far into the cube that particular screen pixel is. It uses that value to darken the pixel based on the distance from the center of the cuboid (but could be any algorithm really).

But it darkens not by multiplying but by standard alpha. There is a shadow color and the alpha is set based on the distance calculated above. So if you set a white shadow color then you will get white highlights instead of shadows… which I guess could be almost like a point light except it doesn’t care about surface normal at all.

I did have a mind to some day see if I could use it to simulate rays of light coming from above or something.

Note: the rendering itself does not render one box at a time. It batches them into one mesh based on the nearest X shadows in frustum where X is a configurable number which is 500 by default.

1 Like

Lighting requires normals. This is only using depth… which is essentially free.

A new water filter WIP …

there is currently no water surface, only scene coloring and refracting, so this material gets applied to the world, then a water surface needs to be drawn in the filter… but it currently looks like ass

19 Likes

…so like JME’s water. (Minus the material being applied to the world part)