• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Plerion

Borders appearing wrong

5 posts in this topic

Hello everybody

My problem is actually described completely with the following picture:
[img][url="http://imagr.eu/up/504ece42b36296_de568740285919deb973f1200d9b8163.jpg"]http://imagr.eu/up/5...1200d9b8163.jpg[/url][img]

As you can see the border of all the chunks (each of them is one draw-call) is visible. As i have observed its repeating a tiny part from below on top and from right on the left which means the texture begins to repeat somehow.

Of course for me it seems to be a problem with the texture coordinates as the sampler sets AddressU and AddressV to Wrap which means the texture gets repeated beyond 1 and below 0 and thats exactly whats happening. So i checked my function that generates the texture coordinates which looks like that:
[source lang="csharp"]
private static void LoadTexCoords()
{
uint counter = 0;
float tx, ty;
// 17 rows of vertices
for (int j = 0; j < 17; ++j)
{
// All even rows have 9 vertices, the odd ones only 8 and are shifted half the unitsize into the middle
for (int i = 0; i < (((j % 2) != 0) ? 8 : 9); ++i)
{
tx = (float)i;
ty = (float)j * 0.5f;
if ((j % 2) != 0)
tx += 0.5f;
TexCoords[counter, 0] = tx;
TexCoords[counter++, 1] = ty;
}
}
}
[/source]

Just a quick explanation:
Im repeating the texture 8 times on the chunk. The vertices are aligned the following way:
[code]
x x x x x x x x x
x x x x x x x x
x x x x x x x x x
x x x x x x x x
x x x x x x x x x
x x x x x x x x
...
[/code]

After all i couldnt find an error with the coordinates or why they would repeat once more at the end. All the last vertices have either u or v set to 8.

In my shader i have the following:
[source lang="cpp"]
sampler BlendSampler1 = sampler_state
{
texture = <blendTexture1>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
[/source]
Does anyone have a clue where the error could come from or if my calculations are wrong for the texture coordinates?

Greetings and thanks in advance
Plerion Edited by Plerion
0

Share this post


Link to post
Share on other sites
Are all the texture tiles placed on a single texture (texture atlas) or are they unique textures ?
In the first case you need to define a border for each sub-texture (8-16 pixels, depends on texture resolution) or you will get mipmapping artifacts at the borders. In the second case you should not use WRAP as texturing mode, but CLAMP. Edited by Ashaman73
1

Share this post


Link to post
Share on other sites
The textures are unique and then blended using alpha values for each of the chunks (the chunk is the one with the border). The problem with CLAMP is that i repeat the texture several times on the chunk so the texture coordinates are from 0 to 8 and wrapped. So when i use CLAMP it looks completely odd. Interestingly its still the same that the border can be seen.
0

Share this post


Link to post
Share on other sites
Some ideas:
1. Subdivide your chunks .
2. As texture mode use clamp, but use only the fractional part of the texture coord to access the texture, here's some shader pseudo code:
[CODE]
vec2 new_tex_coord = fract(tex_coord);
vec4 texture_color = tex2D(textureSample, new_tex_coord);
[/CODE]
0

Share this post


Link to post
Share on other sites
Thank you for your tips. I was using the second version but sadly the results are more or less the same. I start to think that theres another problem, not the texture coordinates but i have no idea what it could be.
0

Share this post


Link to post
Share on other sites
After some more research i came to the following result till now:
The problem appears now only when i go far away from the terrain, in normal prospective view it all looks like a charm when its near but when i go far away and/or into orthogonal view all borders appear.

Good one:
[img]http://imagr.eu/up/5051c5f80686e2_good.jpg[/img]

Still no problems:
[img]http://imagr.eu/up/5051c6af50ed24_stillgood.png[/img]

Bad one:
[img]http://imagr.eu/up/5051c727ee3af3_bad.jpg[/img] (its the same chunk of map is in the two others just without models and from top)

All the samplers are using trilinear filtering.

I have no idea where this is coming from, but i think that its an issue with filtering, right?
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0