The Forester

@staugaard said:
@androlo

I got it to work now, but I dont think you have fixed the issue.

I debugged it, and while all others verts and frags are placed in my asset (eg. Common/MatDef/.....), the grass.vert and .frag are looked up in the root of the asset. Where ofc it cant be found.

If the vert and frag for Grass and GrassImpostor is placed in the root of the asset, it works. So thats my workaround, until its fixed.

Looks cool, nice work :)


Thanks for the input. I'll update the tutorial and ask people to copy the shaders and stuff into their assets until next update. Gonna add the lighting then, and find out the best way of distributing the assets.

EDIT: It's weird tho, I believed netbeans libraries used the same root as the rest of the app. I thought that was the whole idea behind it.

@EmpirePhoenix



Ok I now removed the future objects. If you take the new jar and run it, the log should be more specific about what is causing the error.



I would be very interested in that log if you want to give this another go.

Wel it does work now ā€¦ Why ever. Probably a good idea to not use Futures anyway, as they are somewhat deadlock provoking.

1 Like
@EmpirePhoenix said:
Probably a good idea to not use Futures anyway, as they are somewhat deadlock provoking.

Lol, @pspeed you see what you did? xD Now theres such lore out there, people blaming their bad threading on Futures ;)
Its not about the Futures, the issues paul mentioned can happen as well when you just use synchronized and multiple threads in a bad way.
@normen said:
Lol, @pspeed you see what you did? xD Now theres such lore out there, people blaming their bad threading on Futures ;)
Its not about the Futures, the issues paul mentioned can happen as well when you just use synchronized and multiple threads in a bad way.


Heheh. Sorry.

Though Futures are somewhat more dangerous than synchronized() because you think you are safe and can have things crop up in slightly stranger ways.

But my advice is to avoid BOTH of them when possible. Use the java.util.concurrent classes in a fully asynchronous arrangement.

Any time you can't easily visualize the flow of your data you will have problems no matter what, though.

Yeah, I agree but again note that the way I use the Futures in the proposed threading for the jME3 runloop has nothing to do with blocking really. Its just a state check which would be more cumbersome to implement threadsafe otherwise, you get the Future for free. This is why I donā€™t think its good when people get ā€œafraidā€ of them. Starting out only knowing about ā€œtheres some queue I have to useā€ and just going async all the way is basically like slamming synchronized() everywhere, you know why its fixing stuff but you donā€™t 100% know how it happens. I think threads should be a bit more in the minds from the start, hence the more ā€œformalā€ approach.

@EmpirePhoenix



Very glad it worked. Tho tbh. I did change some other stuff as well but I canā€™t remember what it wasā€¦ I guess its not completely safe yet.



Also this is just a temporary fix, but Iā€™ll warn well in advance before changing the system back. I know what the problem is now, its because I did some quick-fixes right before releasing.



Working on the light now yā€™all. Got some issues with point lights but it should soon be fixed.



Iā€™ll not update until i have added shadows tho, Iā€™ll make that the goal of next update - light and shadows.

Iā€™m going all in with the terrain stuff now. I didnā€™t want to at first cause a lot of features would be lost (like full grid- and pagesize control, and the timed cache for expired pages), but those things can be added later when its all in place.



Iā€™m gonna use the terraingrid for loading, and divide the geometry into patches (much like like the terrainquads do).



Iā€™ve extended ImageBasedHeightMap for densitymaps now. I donā€™t care if it calls the density values heightData and uses getHeight etc.



Currently, the visibility and fading stuff is done from within the paging engine, but that could be moved into controls instead; much like the lod controls work on terrain.



Also, I think the planting algorithm stuff can probably be plugged in much the same way its being done for terrain generation.



EDIT: I wounā€™t use the actual terraingrid class and terrainquads etc. of course. Just model this system after that system so its easier to make jMP plugin.

@androlo said:
EDIT: I woun't use the actual terraingrid class and terrainquads etc. of course. Just model this system after that system so its easier to make jMP plugin.

Why not? Are you completely reinventing the terrain wheel here?

Actually I like it eing independent from the terrain stuff mostly, I only have to implement Terrain ot and offer the getHeight method, and have grass on anything thats not even remotly a terrain (like house ruins).

Can anyone help me? I just tried the tutorial and this is the result:



http://i.imgur.com/12ZSH.jpg

@EmpirePhoenix said:
Actually I like it eing independent from the terrain stuff mostly, I only have to implement Terrain ot and offer the getHeight method, and have grass on anything thats not even remotly a terrain (like house ruins).

Its not about being dependent on that stuff its just that if you want heightmap-based terrain pages then it would be silly to implement that again.
@normen said:
Its not about being dependent on that stuff its just that if you want heightmap-based terrain pages then it would be silly to implement that again.


I am not using any terrain stuff, I'm just basing the grass-generation on the heightmap system (for densities) etc. It works perfectly and I would like to utilize as much terrain system code where ever its possible.

And also use the "general concepts" of it, like having lod controls (rather then controlling fading etc. from within the paging engine).
@ancalagon said:
Can anyone help me? I just tried the tutorial and this is the result:


Try setting face culling: Off, and Blending mode: Alpha. That can be changed in the material editor "Additional RenderState"

I'm putting some general vegetation rendering stuff in the tutorial. There will be some info there, and links to other tutorials.

Alright, sounded like you wanted your own version of heightmap terrain to use the vegetation on.

Thanks, that worked great. Looks much better now.

Put up a short video showing lighted grass. Its in the info post.

Hi



I trying out the density map approach from the tutorial.



Am getting this error:



2011-12-05T18:10:11.699+0100 SEVERE Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.NullPointerException

at com.jme3.collision.bih.BIHTree.(BIHTree.java:118)

at com.jme3.collision.bih.BIHTree.(BIHTree.java:131)

at com.jme3.scene.Mesh.createCollisionData(Mesh.java:839)

at com.jme3.scene.Mesh.collideWith(Mesh.java:855)

at com.jme3.scene.Geometry.collideWith(Geometry.java:444)

at com.jme3.scene.Node.collideWith(Node.java:494)

at com.jme3.scene.Node.collideWith(Node.java:494)

at com.jme3.scene.Node.collideWith(Node.java:494)



Do anyone have an idea, what im doing wrong, or did someone see the same problem? And a side question, do I need to flip my density map or not?



EDIT:

If I change the mapSize value from 512 to below 500 i dont get the error, but then my density map dosnt ā€œfitā€ to my roadsā€¦



GrassGrid grassGrid =forester.createGrassGrid(500f,400f,100f,100f,512,false);

@staugaard

Iā€™ll look at it, sec



What mesh causes this error btw, is it a grass mesh?

@androlo said:
@staugaard
I'll look at it, sec

What mesh causes this error btw, is it a grass mesh?

The error comes the second the scene is shown, so cant give more detail there.