LWJGL Forum

Programming => General Java Game Development => Topic started by: TheDude on January 24, 2015, 20:12:45

Title: 3d grass
Post by: TheDude on January 24, 2015, 20:12:45
How would you go about rendering grass in lwjgl. I know you can use shell rendering but how.
Title: Re: 3d grass
Post by: quew8 on January 27, 2015, 11:21:35
Ask a more specific question. Try it out, normally the process of trying will allow you to solve many of your problems for yourself.

If you have some code that doesn't work and you don't know why, ask us.
If you have no idea where to start, find a tutorial (there is always a tutorial).
If you are having trouble understanding a specific part of the tutorial ask here.
If you are having trouble porting the tutorial to Java/OpenGL/LWJGL ask here.
If you don't understand any of the tutorial, find another one and if you don't understand that one either, start with something simpler.
Title: Re: 3d grass
Post by: TheDude on January 30, 2015, 16:08:05
There is a tutorial at this link http://www.xbdev.net/directx3dx/specialX/Fur/ (http://www.xbdev.net/directx3dx/specialX/Fur/) which covers shell texturing i jus have no idea how to translate it into LWJGL.
Title: Re: 3d grass
Post by: quew8 on January 30, 2015, 21:35:40
First of all I've had a quick look and I think this http://www.catalinzima.com/xna/tutorials/fur-rendering/ (http://www.catalinzima.com/xna/tutorials/fur-rendering/) is a better tutorial in terms of explanation and code examples and stuff.

Now what is your experience with LWJGL and OpenGL? Because I find all of the code in that tutorial readily understandable and if you are familiar with OpenGL and GLSL it should be a simple matter to look up some of the finer points of XNA's shading language (is it just HLSL) and the rest is understandable. Essentially all this is doing at the basic level is rendering a textured quad, with alpha testing, many times with a slight displacement.

So can you render a textured quad? Can you enable alpha testing? Can you program a shader which can implement a slight displacement (or even just do this in your own host program)?

I'm just not sure which bits you need help with, and if I don't know then I would have to write a whole tutorial specifically for OpenGL and LWJGL, which I'm not going to do. 
Title: Re: 3d grass
Post by: TheDude on January 30, 2015, 22:49:27
I tired this but i just can't seem to be able to port it to java. I have a character(.obj file) with a texture if this is any help.
Title: Re: 3d grass
Post by: quew8 on January 30, 2015, 23:03:16
It doesn't.

Can you render that texture onto a quad? Because as I said before if you can, then you are half way there.
Title: Re: 3d grass
Post by: TheDude on January 31, 2015, 00:35:40
yes
Title: Re: 3d grass
Post by: quew8 on January 31, 2015, 10:23:12
Then what is the issue? Do you not understand the technique?
Title: Re: 3d grass
Post by: TheDude on February 01, 2015, 12:26:59
It all makes sense to me but can't for the life of me get it ported properly to lwjgl without errors.
Title: Re: 3d grass
Post by: quew8 on February 02, 2015, 08:24:03
So post the code you have tried and tell us why it doesn't work and/or the errors that it generates.

Then we can help.
Title: Re: 3d grass
Post by: TheDude on February 02, 2015, 20:10:20
Ok, I'll get,to that this,week.