The Forester

Doing some debugging now.



I just want to tell those who does not know - Java VisualVM is great. It is so easy to use and has all the details you’d ever need. It also has a plugin to view direct and memory mapped buffers (amount, total size etc.).



If you want to run a simple, clean profiling-session with visualVM do this:


  1. Start Java VisualVM. It’s an executable in the java sdk “bin” dir.


  2. Update it with any plugins. Its netbeans based, just like jmonkey platform.


  3. Run your jar directly. Not from netbeans or eclipse or jmp or whatever. It’ll show up as a new process in the list. Don’t start the app, stay at the settings dialogue.


  4. Double click the process, or right click and select “open”.


  5. Start the app.
1 Like

Uh, the “NetBeans adaptation” is exactly the same software :wink: The profiler inside the SDK is the “Java Profiler” and idk what option you miss but they should all be there.

Yes I don’t know how to add plugins to it tho, or how to configure it properly for all the advanced features, because it seems to mess with the data somehow. Like when i run apps inside platform, direct buffers registers as memory mapped buffers sometimes. And some of the values are not what you would expect because of sdk “polluting” everything.



I think this approach was much cleaner and better, but I really want things perfect. App gets its own jvm and you can count things easily and look and “feel” how it behaves.

1 Like

The app also has its own jvm when you run it inside the SDK, you seem to be doing something severely wrong when you profile in the sdk ^^

@Normen

Thank you! I found the problem. The app didn’t show up in visualvm because it was using different jvm then the platform. :roll: I changed it, and now it shows up as a new process under “local” in visual vm when i run it, as it should. :slight_smile:



This solves that issue I suppose, but I still don’t know how to update the profiler plugin with the buffer stuff however (or anything else). I must ask, how did you do it?



I looked in the plugin site, and can’t find. It is a rather new feature, and the profiler plugin seems not to be that new (latest version is for netbeans 6.7 according to profiler.netbeans.org), so i figured it just wasn’t available yet.

1 Like

The plugin only wraps the internal jdk profiler, again its the same software.

Ok, thanks. I’ll put this aside for the time being. The real problem is I always get only 0 direct memory usage from the memory reports you get when pressing ‘M’ in apps. I still can’t figure out why, gonna make a report see if someone else has this problem.

1 Like

Moved self shadowing to the vertex shader now.



Just scrambled this together now, so it needs some more work, but I’ll include it in this update anyways. It can be enabled/disabled in material options.



Basically, the grass quads has an xz-normal at each vert. First the light direction is normalized to the xz plane and dotted with the normal. That way the strength of the light is calculated (as it’s usually done). Second, a tangent is constructed from the quad normal, and dotted with light. By taking the sign of that value it finds out whether the light strikes the quad from “the right or the left”. That sign is then checked against the texture-coordinate of the vert to determine whether or not it should be shadowed.



It does a similar calculation for height, then apply the results to the light value. It is repeated for all lights.



Btw. now that vertex colors aren’t being used for shadowing anymore I added a “vertex colors” option as well (needs to be checked if using vertex color maps). The grass no longer has a vertex color buffer by default.



Also i moved the fade value to texCoord.z, but its just temporary heh. Running out of varyings that does not have an #ifdef around them.

1 Like

Updated yesterday. Fixed the color map stuff i mentioned in the changelog today. Gonna patch that and a few other minor things later today. In other words, great news for the 0 people out there using foresters grass system with vertex color maps. :slight_smile:

If you’re using this lib read the first post. There’s been some changes in the release schedule.

I love the terrain system.

wow i just noticed this topic have ~170 posts.



i waited with updating Forester.jar, but now there must be many changes :slight_smile:

it is lots of changes, but i’m integrating it into my app making framework now so I can do some hard core testing. I’ll update it to version 1.0.0 when i’m done.



I’d wait until then (will take a few weeks probably). It will be fully terrain-grid compliant etc.

One thing I wonder about, how do you make sure the tree imposters always face camera?



Point mesh?

Quads taht are rotated in update? (and not batched then?)

batched quads, that rotate in shader?

Billboards? :slight_smile:

That would be äquivalent to my second , but since they needed to be updated seperatly you could not batch them.

Downloaded the forester plugin with SDK, was hoping to use it with the terrain editor…



Two things



-layer.setLocalDensityFactor(0.1f); I don’t think this function exists any more, i am using .setMultiplyDensity instead (or something like that, i’m at work so i don’t have the code in front of me)



-Your init method asks for a “Terrain” Object, And I made a terrain in the terrain editor, and i’m loading it in as a spatial, is there an easy way to load it as an object that implements Terrain interface, or can you cast/convert from a spatial to something that implements the Terrain so i can make grass on it?



Thanks for the help,

@kbender88 said:
-Your init method asks for a "Terrain" Object, And I made a terrain in the terrain editor, and i'm loading it in as a spatial, is there an easy way to load it as an object that implements Terrain interface, or can you cast/convert from a spatial to something that implements the Terrain so i can make grass on it?

Sure, look at the scene explorer for the name of your terrain and then just go
[java]
Terrain terr = (Terrain)loadedModel.getChild("terrain");
[/java]
1 Like

Thanks Normen!



I will give this a try on my lunch break, hopefully get some screen shots here…



Wish i was still in school and i could just skip class to work on this!

Well Normen’s solution worked, but then i ran into another problem



i couldn’t find the Grass.j3m file that is referenced in the tutorial so i just made a basic green Material…

I tried to run it and got something like an unsupported materials error.



Does the Grass.j3m come with the library and i just wasn’t looking in the right spot? or do i need to get it from somewhere else/make a special material