Tree Editor… now with save and load!

your trees look REALLY good. nice job.

btw i think ive experienced the same bug as your checkmark issue. im working on a level editor where you click on the terrain to place where various items in the game should spawn.

for some reason every now and then the ray seems to go straight through the terrain and i’ll click on the same spot over and over and mousepicking never sees the terrain, but if i move my mouse by the slightlest amount it works fine, and if i try to move it back to where it was it works fine, but itll eventualyl fail again in one particular spot.

ive always assumed its because most of my “terrain” is just a bunch of large boxes though.

@icamefromspace said: your trees look REALLY good. nice job.

btw i think ive experienced the same bug as your checkmark issue. im working on a level editor where you click on the terrain to place where various items in the game should spawn.

for some reason every now and then the ray seems to go straight through the terrain and i’ll click on the same spot over and over and mousepicking never sees the terrain, but if i move my mouse by the slightlest amount it works fine, and if i try to move it back to where it was it works fine, but itll eventualyl fail again in one particular spot.

ive always assumed its because most of my “terrain” is just a bunch of large boxes though.

That one for sure would have been caused by the bug I fixed in BoundingBox because that’s the exact issue I was having in 3D.

Prototyped camera-facing billboards with proper lighting… it’s getting somewhere:

1 Like

Lighting shows up better in a video:
[video]Tree Generator Side Project - Panoramic - YouTube

The thing I like about this technique is that it’s really cheap for the effect… and still looks pretty great when inside the canopy. Most other cheap techniques seem to completely fall down up close.

For the stats curious: there are 64 shader-billboarded quads in the leaf mesh in this video.

4 Likes

That’s pretty neat Paul!!

@pspeed said: Lighting shows up better in a video: [video]https://www.youtube.com/watch?v=36-dDY29i2g[/video]

The thing I like about this technique is that it’s really cheap for the effect… and still looks pretty great when inside the canopy. Most other cheap techniques seem to completely fall down up close.

For the stats curious: there are 64 shader-billboarded quads in the leaf mesh in this video.

Again Paul, awesome work! Another amazing thread to follow, love it!

Before I get started tonight, I’ve had this image up for inspiration. @nehon pointed me to an image of a tree generated by some other software and then I tried to recreate it, at least within what this little editor will do. It’s not really that much like the original but it’s a cool looking tree.

It does show that I need to add some texture scaling parameters soonest.

Edit: for reference here is a link to the other tree in question: http://www.speedtree.com/images/modeler_lrg.jpg
I could have made by branches thinner and denser with some more inclination but I already liked what I ended up with instead and didn’t want to mess with it. :slight_smile:

2 Likes

Got shadows working with the billboarded quads. Two different views of the same tree:


I was really worried that this was going to look completely unusable. While it’s not perfect, I think it’s workable. Certainly in still shots I’ve got it to the point where you can’t see anything wrong. It’s only when moving around that the quad self-shadows crawl around the inside of the tree in ways I’d prefer they didn’t. Oh, well… sometimes we have to compromise. There’s no doubt that the nice leafy shadows on the ground really shine.

1 Like

So, I’ve uploaded a new version with leaves and some other fixes… and some other ‘breaks’…

Links are the same:
http://mythruna.com/temp/TreeEditor/TreeEditor-Windows.zip
http://mythruna.com/temp/TreeEditor/TreeEditor-Linux.zip
http://mythruna.com/temp/TreeEditor/TreeEditor-MacOSX.zip

The big differences are leaves and shadows… both of which start toggled off in case my shaders are bad (in the case of leaves) or your computer has problems with the shadow filter.

The variation stuff had some bugs in it before where sometimes bends would fold back on themselves… like tree prolapse. I’ve fixed that issue but introduced a few more. First, gravity does not have as strong an effect as it used to… and it’s a shame. Second, variation is a bit too uniform (ie: too exaggerated) as it goes down the branching. I’m kind of ok with that one because it’s rather arbitrary. Some of the normal generation also gets a little confused as a by product of the tight and overlapping bends.

Anyway, it’s not really fixed yet anyway so expect more changes. Some of the bends are still too drastic and the textures stretch too much on the long side of the bends, I think. I had something else to say on the subject but my brain is very tired and it’s time for bed… ah yeah, the variation parameter will be smoothed out a little too. Right now there is no subtlety because it’s internally hard-clamped rather than properly ranged. (That statement makes sense to me anyway and I will need it in the morning. :D)

Here is a big gnarly tree pic so you could copy the options if you wanted to:

2 Likes

Hi,
Just gave it a try, all works well although that picking bug/feature is a tad annoying.

Only one thing failed for me was shadows, as soon as I turn it on the program crashes with
“Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
IllegalStateException: Framebuffer has erronous attachment.”
I think I saw the same issue with the shadows on the marching cubes you did.

Personally I’m not into the billboarded leaves as the effect of moving around the tree while looking at it is a bit off plus the leaves floating in mid air gets on my OCD a bit. (yes I have bad OCD, sorry) Still for speed and efficiency esp being a generated model it does work well and for many types of games this would suit perfectly.

As always good work, very impressive.

Cheers
–Radan.

Edit: as far as the Shadow crash issue and that I had it on the other demo, I might need to look into a few test-cases as it seems this card is a bit different somehow, its only a cheapish nVidia GT630 card so fairly basic. If I can ask what shadows this program uses maybe I can run some tests and start a troubleshooting thread if it looks like an engine bug (although clearly a rare one)…

@radanz said: Hi, Just gave it a try, all works well although that picking bug/feature is a tad annoying.

Only one thing failed for me was shadows, as soon as I turn it on the program crashes with
“Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
IllegalStateException: Framebuffer has erronous attachment.”
I think I saw the same issue with the shadows on the marching cubes you did.

Personally I’m not into the billboarded leaves as the effect of moving around the tree while looking at it is a bit off plus the leaves floating in mid air gets on my OCD a bit. (yes I have bad OCD, sorry) Still for speed and efficiency esp being a generated model it does work well and for many types of games this would suit perfectly.

Yeah, for one, it’s extremely rare to be orbiting a tree like we are in an actual game. I think some of the “leafs floating in air” could be fixed by simply editing the leaf atlas to not have leaves floating in the air. One could even add twigs if desired.

This is what it looks like right now and I spent a matter of 10 minutes creating it:

@radanz said: As always good work, very impressive.

Cheers
–Radan.

Edit: as far as the Shadow crash issue and that I had it on the other demo, I might need to look into a few test-cases as it seems this card is a bit different somehow, its only a cheapish nVidia GT630 card so fairly basic. If I can ask what shadows this program uses maybe I can run some tests and start a troubleshooting thread if it looks like an engine bug (although clearly a rare one)…

[java]
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
if( settings.getSamples() != 0 ) {
fpp.setNumSamples(settings.getSamples());
}

    DirectionalLightShadowFilter shadows = new DirectionalLightShadowFilter(assetManager, 4096, 4);
    shadowFilter = shadows;
    shadows.setShadowIntensity(0.3f);
    shadows.setLight(sun);
    shadows.setEnabled(showShadows);
    fpp.addFilter(shadows);
    viewPort.addProcessor(fpp);

[/java]

Odd,
I put that shadow code into a basic test app and I get shadows and no error…
Maybe something to do with how the shadow affects the model or other shaders in use?
At least I know its not the shadow filter.
Edit: btw all the jMe-Tests using shadows work without issues for me.

Test app had just a basic large thin box for ground using standard lighting material (diffuse & normal) set to cast and receive shadows, a basic 2x2x2 box floating just above it also with similar material (different textures) also set to cast and receive.

Weird, if you decide to release source code I’ll wait and play more that way, something is triggering it. Unless you have an idea.

Cheers
–Radan.

@radanz said: Odd, I put that shadow code into a basic test app and I get shadows and no error... Maybe something to do with how the shadow affects the model or other shaders in use? At least I know its not the shadow filter. Edit: btw all the jMe-Tests using shadows work without issues for me.

Test app had just a basic large thin box for ground using standard lighting material (diffuse & normal) set to cast and receive shadows, a basic 2x2x2 box floating just above it also with similar material (different textures) also set to cast and receive.

Weird, if you decide to release source code I’ll wait and play more that way, something is triggering it. Unless you have an idea.

Cheers
–Radan.

I am eventually going to release the source.

In the mean time, did shadows fail even with leaves turned off? I use my own shader for the leaves but the regular lighting shader for the trunk and branches.

And in case any of it is relevant, here is my tree material setup:
[java]
treeMaterial.setColor(“Diffuse”, ColorRGBA.White);
treeMaterial.setColor(“Ambient”, ColorRGBA.White);
treeMaterial.setBoolean(“UseMaterialColors”, true);
treeMaterial.setTexture(“DiffuseMap”, bark);
treeMaterial.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
[/java]

The tree geometry is set to ‘cast and receive’. Still, I don’t know why any of that would affect the filter itself… it seems to fail to allocate the buffer or something.

And so in case environment is relevant, here are the command line switches I use:
-Xmx1024m -XX:MaxDirectMemorySize=512m

oookay, just to add to the WTF bin, just tried again to test if it was the leaves and now the shadows are working perfectly… ummm…

restarted the app many times trying different things and its working fine…

Yeah I’ll leave it for now, if I find a particular sequence or trick that makes it happen I’ll report it but for now I’m going with confused.

Cheers
–Radan.

… maybe I have a twitchy card…

@radanz said: oookay, just to add to the WTF bin, just tried again to test if it was the leaves and now the shadows are working perfectly.... ummm...

restarted the app many times trying different things and its working fine…

Yeah I’ll leave it for now, if I find a particular sequence or trick that makes it happen I’ll report it but for now I’m going with confused.

Cheers
–Radan.

… maybe I have a twitchy card…

Could be. Was the SDK running when it was/wasn’t working? Maybe it’s complicit in some way. Any other graphics things running maybe?

I had the SDK both open and not before when it was crashing and again now when its working fine.
It was just reliably crashing before and now it wont crash no matter what I do, I even rebooted the pc to reset everything and its still working fine.
The ONLY thing I’d done in between was have a quick look at the “Java Mission Control” suite that I just discovered came with the JDK I installed a while ago. But I don’t see how that could affect anything.
Honestly don’t know, maybe my GFX card glitches when its cold or something…
Meh, ignore for now, see if it pops up again later… Gawd I hate these kind of errors…

Cheers.
–Radan.

It uses the shadowFilter, I’d be interested to know what’s the issue too :p.
There has been reported issues on Mac too with shadows even though the standard test case works.

I really don’t know… it was failing 100% before when I tried to enable shadows, now its working 100% of the time.
And that other marching cubes demo that was failing 100% on shadows before is also working now…
Something must have changed here but nfi what, I didn’t install or update anything, the only things I did in between was look at the JMC as above and have a look inside the assets.jar that came with the tree code… shrug bloody computers…

EDIT: AHA!!! I deleted the treeEditor folder and re-unzipped from the download, ran the program AND IT DAMN WELL FAILED!!!
soooo… I’m confused again… can only guess that something wrong with the code failing to extract something from the jars on my pc…
going deeeeper into this rabbit hole here…

Edit2: ok now its being intermittent without touching the jar… I’ll see if I can isolate a trigger… or if its truly random… :cry:

I was able to make a little progress on tree roots tonight. Most of my free dev time last night was spent reorganizing the UI a little bit. The plus side is that the RollupPanel I used and now the new TabbedPanel are almost ready to be dropped into Lemur directly.

Anyway, enough of the boring stuff… It’s not perfect yet but mostly because of other bugs in the mesh generation that are also affecting the branches, too.

Here is what it looks like from above ground with these settings:

And here it is below ground:

Oh, and if like in my case, you might have trees whose roots would stick out of the sides of hills and stuff… here is one more level activated:

Note: gravity and some other things would need to be tweaked but it was just a test to see what would happen… and it was too cool not to post.

4 Likes

So I didn’t really have any time to work on this tonight but I did make a lot of progress yesterday (see above) and wanted to share it.

Links are the same:
http://mythruna.com/temp/TreeEditor/TreeEditor-Windows.zip
http://mythruna.com/temp/TreeEditor/TreeEditor-Linux.zip
http://mythruna.com/temp/TreeEditor/TreeEditor-MacOSX.zip

In this version, the UI has been reorganized into tabs. The “roots” tab is where the new stuff is.

Still lots of bugs and gravity is still half-busted… but it’s fun to play with and now there are roots!

Here is a screen shot of a big fat tree with gnarly roots.

3 Likes