The Forester

Its ready now but I’m gonna wait to tomorrow afternoon (GMT) before updating the plugin I think. That way I’m free for some time and can respond fast if someone downloads it and there is problems.

Updated the plugin. Started on the tree tutorial but its not completely finished. All the tutorials can now be accessed from here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:contributions:vegetationsystem



Gonna clean the OP up tomorrow and finish the tree tutorial.

There’s a bug in uniform tree distribution because of an indexing error. I fixed that, and also some weirdness with tiles not being reloaded properly when using rigidbodycontrols on trees.



Gonna patch it later today or early tomorrow. Probably today. If you don’t want to bother with re-installing, wait for the patch. I’ll post here when I patch.

Patched that thing yesterday, but it doesn’t matter…



I got working rigidbodycontrols for batched geometries now. Gonna be a new update in the coming days when I have checked around some more for bugs. This means the tree system (tho it needs polishing) has pretty much everything but impostors done.



The tree system now works like the grass, but with physics:



Each tree-tile is divided up into smaller tiles (pages). All trees within a page are batched. They have one rigidbodycontrol with a compound collision shape, and the tree geometry and the physics objects are removed/added from scene/physicsspace automatically. :slight_smile:



Again, because of the fast progress - if you haven’t already updated, wait for the next update instead. Its due in a few days.



Tutorials will be updated.

2 Likes

I’ll go through the terrain integration once more before the next update, so maybe a day or two more. It should be possible to use alpha maps from terrains as densitymaps after the next update (there might be a problem now).



If you want to base the densitymaps off of terrain alpha maps, but not use them directly (process them first somehow), that is possible. Have to implement an interface or extend a loader class tho, but I would not recommend doing that yet.



After this update is finished, and any bugs has been weeded out, grass will be stable. No more major changes. Then it could be extended.



I will most likely flag it as stable sometime during this month.



About placing trees/foliage/ground clutter. It will also be possible to do that through alpha maps (or density maps in general) for procedural placement. There’s only coordinates or uniform random placement available now tho.



About the editor stuff. I’m thinking about making a test-system where the tree-loader take scene files as arguments.



The idea is simple: You make a scene, and then place trees etc. You then create a treelayer from the model in question (treeLoader.addLayer(“treeModel.j3o”,usephysicsornot)). Then i make a method to enable scene files as arguments. When the tree-loader gets the scene it finds all trees in it, removes them and creates a TreeData for each one, then creates batches etc. to replace them.



It has many benefits:


  1. Regular scene files can be made and used.
  2. It (of course) means that the editor can be used to place trees.
  3. If the scene is updated, the trees will be updated too.
  4. It would be easy to make an option to permanently replace any trees with the Forester-objects for release, or to create new scene files for that, to avoid the conversion stuff in the final version.



    Been doing some thinking and it kind of makes sense to operate directly on j3o files. That way everything just works as normal. The tree-loader would just do its thing, nothing would have to change in order to use it.



    Grass is different tho, and probably has to be integrated through a terrain-editor plugin (unless you use the density-maps from alpha maps thing). Already started playing around with that a little.

Great news.



treeLoader.addLayer(“treeModel.j3o”,usephysicsornot) i see you have removed the “batching” boolean. Please tell me, that you still lets us deciede that.

yes its just a crap example. I think the actual method is addTreeLayer also hehe :slight_smile:



EDIT: Also you link models not model names… sloppy stuff from me hehe.

I set up a google code page now. I’m gonna be moving issue tracking and all of that stuff into that page instead.



I’ll probably put the code as a nb project there also, so it can be downloaded with examples etc. kind of like how shaderblow works. It will still be available from the plugin list tho. The jme-plugin itself will still be uploaded to the same place it is now.



The page is just started so there’s not much contents, but the link is: http://code.google.com/p/the-forester-jme/. I’ll update the OP when i get the page in order.

Shadowing included next update.

This new repository has me confused. How come this can’t reside entirely in jmonkeyplatform-contributions?

@erlend_sh

It is mostly because I wanna separate the dev-stuff from the rest. Gonna do a lot of experimentation there, add extra stuff that is not really needed for the plugin etc. It’s also starting to become pretty big so I figure I move all the dev-stuff there, and just provide a clean plugin and tutorial like before.



*********************************************************************************************************************************



Anyways I reduce memory footprint a lot for the next update. The densitymap float arrays will not be stored now, but generated/regenerated whenever geometries are being loaded.



As an example: If you use four grass layers, and use 512x512 densitymaps. That means four different 512512 float arrays for density data. Say you keep 16 of those loaded at any one time, that is in the order of 1644512*512 = 67 megabytes. That’s not an extreme example. This memory goes away at the expense of somewhat longer loading-time, but its not really noticable.



The image buffers can be eliminated also btw, through intelligent use of the terrain-texture alpha maps.



Shadows is going well. Hopefully there will be full PSSM shadowing + SSAO support in the next update.

1 Like

gonna update this weekend. full physics integration and some shader updates. started working on visual quality more now, gonna change some things make the grass look better with anti aliasing and alpha to coverage.



There are still some issues with shadows casting/recieving by transparent objects, so it will be pushed to next update instead.

1 Like

@androlo



anti aliasing and alpha to coverage. Will we be able to turnoff these if we want?

Yes of course. I am not forcing those settings, just trying to make sure it looks good even when they are enabled. Doing checks from two computers now, one with low settings and one with high.



EDIT: I noticed transparency was a bit too high with alpha to coverage. Its like the grass is translucent almost, like it filters alpha too much. Gonna have to get around that. Maybe its just because of a too low resolution texture, it could be many things - either way I’ll find out what causes it and make it good. :slight_smile:



Shadows from transparent objects still a problem tho, can’t include those now. It’s not the shadows themselves that look bad, its the objects casting them.



For example, shadows from tree foliage looks ok, but if you look through the transparent parts of the foliage the shadows are blocked out. It looks pretty much like what you get if you have 0 alpha in the texture, but does not discard the pixel. I need to fix that.



This causes issues with the grass. Also, there seem to be pretty weird results when casting from and receiving onto transparent areas. Gonna have to work with the shaders to fix it.

Added some new density map scaling stuff now. This is to facilitate for the terrain alpha texture use.



First, the density map does not have to be same size as the grass tiles.



Second, you can now do simple transformations of the alpha map values. Like you can choose to base planting on the square of terrain alpha for instance. This will make grass covers diminish quicker when the density becomes lower. Also you can set a threshold now (like you can use threshold 0.5, that means absolutely no grass will be planted if terrain alpha is less then 0.5 etc).



Everything is grass-layer based tho, so you can use different settings for each layer.



This will not change anything, the standard stuff will be used by default (no deprecated methods).

Here’s a picture of some trees and grass, and some balls i was chucking at the trees. Gonna do a new video soon.



http://www.fojop.se/images/dist/treesgrassballs.png

4 Likes

Oh that looks very nice! By the way, the lighting might be a bit off on those grass, the shadows should be on the right side but it seems they are on the bottom side

Holy cow, … it looks awesome… Definitely need some FXAA cause the tree chunk need “antilias” but still look awesome … Can’t wait the video!

Looking great Androlo!

Thank you all. It does start to look more alive I think to, despite the crappy grass texture.



The grass self-shadowing is just vertex-colors at this point, to make it darker near the ground, but I suppose the vertex coloring should be changed based on light dir. at least as an option for people using static lights. It seems like a good idea.



There are no pssm shadows yet. I am working on them, just having some trouble with the transparent areas, so it will have to wait until after this update.



I’ll definitly use AA in the video, and higher resolution. And more but smaller grass… And some flowers too hehe.

1 Like