textur Problem - help needed

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!

textur Problem - help needed

Postby gamescore » Sun Jan 29, 2012 10:41 pm

Hey guys, this is my first post in this community and i hope you can help me with my problems.
First of all, i am no absolut beginner, but created a few little games and now i am looking fowart to something harder...
My new project will be a blockgame using polyvox and perlin noise.
The terrain generagion is almost ready so i went on to the polyvox part.
I read millions of articles about it and now i finished the function witch creates the surface an converts it into an irrlicht scenenode.

But now to the problem:
I am a total idiot when it comes to hlsl and other shader-based functions,
I have no idea on how to create a shader witch applys textures of my textur atlas onto the scenenode.
I think there must be a way to set the textur coordinates to every single voxel.

Hope you can give me a hint!
Thanks in advace.
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby gamescore » Wed Feb 01, 2012 7:46 pm

noone?
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby hybrid » Wed Feb 01, 2012 9:49 pm

I think your problem is not clearly stated. Which parts shall be textured in which way? Do you have the texture ready, maybe show it. If you can give a sketch or screenshot - even better. Also moving this to advanced, seems to fit there.
hybrid
Admin
 
Posts: 13943
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: textur Problem - help needed

Postby gamescore » Sat Feb 04, 2012 2:44 pm

i have this texture atlas:
Image
and i want to textur my terrain (generated with perlin noise and created with polyvox)
In the end the terrain should look like this:
Image
and ingame like this:
Image
(screenshots are made with an older version of my project which didn't use voxels)

i save the values of each block in a struct like this:
cpp Code: Select all
        struct chunkfile{
                core::vector3di position;
                uchar data[chunksizeX][chunksizeY][chunksizeZ];
        };

(For example chunkfile.data[12][12][12] = 1; means that the block at position 12,12,12 has the texture of stone.)

And now i need a hint how i can do something like this with hlsl and polyvox!
I don't know how to send the struct to hlsl and interpret to aply textur coordinates.

PS: sorry for the late answer
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby serengeor » Sat Feb 04, 2012 3:50 pm

texture atlases get mipmaped and corner pixels get merged with other texture pixels which results in this, you should try generating mipmaps yourself.
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: textur Problem - help needed

Postby gamescore » Sat Feb 04, 2012 4:04 pm

but how can i do this?
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby serengeor » Sat Feb 04, 2012 8:08 pm

gamescore wrote:but how can i do this?

For mipmap creation you should look up on google. To set the mipmaps I think you should use virtual void ITexture::regenerateMipMapLevels (void *mipmapData=0)=0;
Not 100% sure this will work as I never tried to do so myself.
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: textur Problem - help needed

Postby gamescore » Sat Feb 04, 2012 8:20 pm

Ok, i will take a try, but what is with the other stuff like the shader?
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby serengeor » Sat Feb 04, 2012 8:51 pm

I just found (actually saw it once before) some nice info also explaining this problem (I guess), you should take a look: http://http.download.nvidia.com/developer/NVTextureSuite/Atlas_Tools/Texture_Atlas_Whitepaper.pdf

gamescore wrote:Ok, i will take a try, but what is with the other stuff like the shader?

I can't really see what you need shader for here.
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: textur Problem - help needed

Postby gamescore » Sat Feb 04, 2012 9:04 pm

I can't really see what you need shader for here.

i think its not possible to handle the terrain texturing (applying the textur coordinates) to the terrain

PS: i am reading the article now.
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby gamescore » Sat Feb 04, 2012 11:29 pm

i got a tipp from viror (he has the same problem and still doesnt solved it) to read about triplanar texturing and make a shader which applys the texturecoords to every single voxel in my terrain-scenenode. what do you think about this idea?
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Re: textur Problem - help needed

Postby serengeor » Sun Feb 05, 2012 12:10 am

gamescore wrote:i got a tipp from viror (he has the same problem and still doesnt solved it) to read about triplanar texturing and make a shader which applys the texturecoords to every single voxel in my terrain-scenenode. what do you think about this idea?

The problem won't go away unless you generate mipmaps yourself that won't have the edge bleeding problem (or w/e the term is for that). I think that Lonesome Ducky tried to implement that, though it seams that he hasn't finished it?.
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: textur Problem - help needed

Postby REDDemon » Sun Feb 05, 2012 9:08 pm

using triplanar mapping with atlas is more expensive since you need to check in wich sub-texture you are (fmod usage required I suppose and few "if" clauses), and don't remove the problem of seams. Instead of using a atlas what about using 4 different textures?
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: textur Problem - help needed

Postby serengeor » Sun Feb 05, 2012 10:10 pm

Using different textures instead of atlas would solve the problem, but then you would need separate mesh buffers for every texture, wouldn't you?
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: textur Problem - help needed

Postby gamescore » Wed Feb 08, 2012 7:17 pm

so all in all, what is the easyer way?
gamescore
 
Posts: 35
Joined: Sun Jan 29, 2012 10:21 pm

Next

Return to Advanced Help

Who is online

Users browsing this forum: No registered users and 0 guests