Well I know you don’t like this…but an horizontal quad in the canopy with a rendered texture of the leaves from the top would avoid the issue…
That’s doubling the triangle count though…But I guess it would be acceptable.
@nehon said: Well I know you don't like this...but an horizontal quad in the canopy with a rendered texture of the leaves from the top would avoid the issue... That's doubling the triangle count though...But I guess it would be acceptable.
It would have to be invisible to the regular render though… or it would look so bad as to make no one care about the shadows. Which I guess would also solve the problem.
The issue then is also that I need to worry about self-shadowing on the canopy looking dumb as a hard line. I was able to get around this with the leaf clumps by offsetting the shadow… but in that case I knew already per clump how far to offset. Whole canopies can be very oddly shaped and it becomes difficult to find a good offset that won’t present some strange artifacts on the trunk. I could potentially hinge the bottom against the trunk and then angle it towards the light… but we see that the solution starts to get more and more convoluted the further down the rabbit hole we go. So something smells.
Given the distance, it would almost be better to use something like my drop shadows… but I don’t know of a good way to make them play nice with regular shadows. I use the same shadow mode markers for drop shadows as the regular shadow rendering uses. They also seem like they don’t play together nicely… but that could just be the order I have them.
An ideal situation might be to use the drop shadows only for the far away shadows (they don’t work when you walk through them anyway). I just have to see if I can work that out. Drop shadows have another benefit in that for a paged terrain situation I may be able to reduce an entire clump of trees down to just one shadow caster volume.
mhh true…
you could disable the color write of the horizontal quad, but that wouldn’t solve the issue of the self shadowing…
Or…you place the quad just right under the canopy…
It would only cast shadows on the trunk and on the ground, which is fine…
Edit : to disable color write though it must be a different geometry than the canopy with a different material…or use some shader magic…
@nehon said: mhh true... you could disable the color write of the horizontal quad, but that wouldn't solve the issue of the self shadowing... Or...you place the quad just right under the canopy... It would only cast shadows on the trunk and on the ground, which is fine...Edit : to disable color write though it must be a different geometry than the canopy with a different material…or use some shader magic…
Right now trunk and canopy are still one quad. So if I render a separate canopy it would only be for shadows.
However, the other issue is that the larger my copse of trees gets, the worse shadowing kills frame right. It seems to go from doubling the rendered objects to tripling them at some point. So it actually might be in my best interest to limit the shadow range and do something else for the low LOD far trees (such as the drop shadows).
A new version is up, links and basic instructions are the same as in this post:
http://hub.jmonkeyengine.org/forum/topic/simarboreal-formerly-tree-editor/#post-285141
Or reproduced here to save you some clicking:
https://simsilica-tools.googlecode.com/svn/trunk/SimArboreal-Editor/release/SimArboreal-Editor-Windows.zip
https://simsilica-tools.googlecode.com/svn/trunk/SimArboreal-Editor/release/SimArboreal-Editor-Linux.zip
https://simsilica-tools.googlecode.com/svn/trunk/SimArboreal-Editor/release/SimArboreal-Editor-MacOSX.zip
New Features
LOD is the biggest new feature. There are a variety of strategies that can be used and up to four levels that can be configured based on distance. Note: when scaling variation is applied then the distance threshold is also scaled. Additionally, LOD is saved when exporting a j3o so it will work automatically when loading a j3o. The only exception is that Impostor mode doesn’t because I don’t know how to embed the impostor image in the j3o.
Other than that, there are some random UI tweaks:
-trees now have a y offset that is separate from the root height.
-added drop shadow filter as a cheaper alternative to real shadows
-avatars can be toggled on and off
-lighting direction can change.
-shadow intensity can change
Probably some other things I’m forgetting. Mostly the tool works the same as before except the new LOD tab and the variety of other new options.
Here is a screen shot that show the latest UI organization:
And here is one showing the new LOD panel:
I know documentation is sparse. So let me know if you have any questions in the mean time.
Documentation is for amateurs!
Looks really nice =) I’m sorta out of it atm, but can you explain how the LoD works… are they index updates stored with the mesh? Hmmm… not getting they question out quite right. Maybe this will make more sense. Is there an LoD manager of sorts you use in your application or is it simply something the user handles with the available mesh data?
Sorry if this still isn’t making sense… I’ll probably be able to ask this better tomorrow, but thought I woulld try (being interested in how does it’s thing and such)
@t0neg0d said: Documentation is for amateurs!Looks really nice =) I’m sorta out of it atm, but can you explain how the LoD works… are they index updates stored with the mesh? Hmmm… not getting they question out quite right. Maybe this will make more sense. Is there an LoD manager of sorts you use in your application or is it simply something the user handles with the available mesh data?
Sorry if this still isn’t making sense… I’ll probably be able to ask this better tomorrow, but thought I woulld try (being interested in how does it’s thing and such)
LODs are separate meshes managed by an LodSwitchControl. It swaps in the appropriate child based on distance.
Right now if you want to use LODs in an application you have two approaches:
- just export the tree as a j3o and use it (with impostors unless you generate them)
- recreate some of what the TreeBuilderReference object does in the editor.
There is no direct library support for generating an all-in-one LOD’ed node because in I expect 99% of the cases an an app that cares a lot about LOD (and doesn’t just want to use the j3o model) there will be batching and other considerations that will require some manual wiring. For example, generally in a paging system LOD is done for a whole tile and not just one tree.
There are currently a few LOD strategies available:
- simply limits the number of branches rendered (figuring that the lowest level will be hidden by leaves when far away.
- the number of sides of a branch can also be limited. So even if your full detail tree has 8 sides your far away tree can have as few as 3
Both of those use the regular tree mesh generator with LevelOfDetailParameters set appropriately. - a flat-poly mode that goes one better and renders every branch part as a single quad that orients itself to the camera. See previous videos for how this looks. It works surprisingly well.
- an Impostor mode that renders an atlas of four views of the tree and uses that on a quad. Currently, the editor code is the only place that has the impostor generator but the code could be extracted.
It’s not really “done” but “done enough” for now.
I sort of have a rule that for some things I’m required to actually try to use it in a real application before I can truly say what the API should look like. So this release marks my change over to getting back to work on the terrain library and adding trees to it. That will tell me what the core SimArboreal library needs to play nice with LOD in a typical app that will care about LOD.
Everytime I try to enable leaves, i get this error:
@JacobAmaral said: Everytime I try to enable leaves, i get this error:
Are you running on an intel card by any chance?
You mean video card? I have a dedicated video card:ATI Radeon HD 5670, Pixel and Vertex shader version 5.0
And for processor AMD A8 3.6Ghz
@JacobAmaral said: You mean video card? I have a dedicated video card:ATI Radeon HD 5670, Pixel and Vertex shader version 5.0And for processor AMD A8 3.6Ghz
Hm.
I think if you run the app from the command line:
java -jar SimArboreal-Editor.exe
…then you will get the full log output for the exception. It’s tough to figure out shader lines without the full shader dump.
Here you go:
No… all of the part above that with the actual shader dump. See, I can’t relate a shader line number to code without that dump because things have been expanded and the lines don’t match with the source code.
Here is a txt file with all of the information of the error:http://pastebin.com/8Ggx21Si
sigh… typo in the declaration of inSize.
Thanks for the bug report. I will try to post a new version later tonight but no promises. I’m deep in the middle of creating the new open source IsoSurface engine + demo… and there have already been a lot of refactoring/reuse style changes to SimArboreal as a result. Not sure I’m ready to trump the last release just yet.
I will probably push something, though.
Thanks pspeed!
Another version is up, links and basic instructions are the same as in this post:
http://hub.jmonkeyengine.org/forum/topic/simarboreal-formerly-tree-editor/#post-285141
Or reproduced here to save you some clicking:
The only real user-facing change is a shader bug fix reported by @JacobAmaral (thanks!)
Full changelog for this release: (https://simsilica-tools.googlecode.com/svn/trunk/SimArboreal-Editor/release/SimArboreal-Editor-changelog.txt)
[java]
- Moved RollupPanel and TabbedPanel out into Lemur core.
- Moved the builder classes out into the new simsilica-tools Pager
library. - Moved PropertyPanel into its own Lemur extension project LemurProps.
- Converted to use the now-standard Lemur ‘glass’ style with just a few
local custom extensions. - Moved the Builderstate out to the builder project.
[/java]
Love this tool ! I just used now and it’s really useful
Thank you man !
@toggy said: Love this tool ! I just used now and it's really useful :) Thank you man !
Glad you get some use out of it. Thanks for the kind words.