Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1034790 Posts in 41744 Topics- by 33339 Members - Latest Member: kabumere

August 21, 2014, 09:54:54 PM
TIGSource ForumsFeedbackDevLogsDwarfCorp: Ruthless Capitalism RTS in a Fantasy World
Pages: 1 ... 13 14 [15] 16 17 ... 49
Print
Author Topic: DwarfCorp: Ruthless Capitalism RTS in a Fantasy World  (Read 55724 times)
Quarry
Level 10
*****



View Profile WWW
« Reply #210 on: January 02, 2013, 09:17:31 PM »

Where have you been!?
Logged

 
Pineapple
Level 10
*****


Love, love is a verb Love is a doing word ~♪


View Profile WWW
« Reply #211 on: January 02, 2013, 09:44:29 PM »

<3
Logged

Schrompf
Level 2
**

Always one mistake ahead...


View Profile WWW
« Reply #212 on: January 03, 2013, 03:05:47 AM »

Experimented with anti-aliasing and different filtering techniques. Unfortunately, if you use AA or texture filtering of any kind with a minecraft-style texture map, you end up with horrible texture seams and artifacts, because the shader will extrapolate into neighboring textures. So no anti-aliasing or filtering for now until I can figure out how to fix this problem.

Clamp the texture coordinate in the fragment shader before sampling the texture. Halve a texel is enough except when mipmapping.

Other than that: I love where this game is heading!
Logged

Let's Splatter it and then see if it still moves.
BleakProspects
Level 4
****



View Profile WWW Email
« Reply #213 on: January 03, 2013, 12:55:40 PM »

Experimented with anti-aliasing and different filtering techniques. Unfortunately, if you use AA or texture filtering of any kind with a minecraft-style texture map, you end up with horrible texture seams and artifacts, because the shader will extrapolate into neighboring textures. So no anti-aliasing or filtering for now until I can figure out how to fix this problem.

Clamp the texture coordinate in the fragment shader before sampling the texture. Halve a texel is enough except when mipmapping.

Other than that: I love where this game is heading!

Interesting idea, but how is it possible for me to clamp to a particular *subset* of the texture (ie, the sub-rectangle representing a block) in the fragment shader? Should I calculating this on the CPU and then sending it over to the GPU? I suppose it might be able to calculate on the GPU side by inferring from the UV coords of each triangle...

EDIT: Wow, apparently this is a huge problem https://developer.nvidia.com/sites/default/files/akamai/tools/files/Texture_Atlas_Whitepaper.pdf As you say, I should be able to do it if I avoid mip-maps.
« Last Edit: January 03, 2013, 01:59:57 PM by BleakProspects » Logged

Schrompf
Level 2
**

Always one mistake ahead...


View Profile WWW
« Reply #214 on: January 03, 2013, 03:17:34 PM »

I have a texture coord clamp solution working here right now, and it really works wonders for the clean appearance of scaled/rotated sprites. It's a pretty simple idea, even though nobody seems to be using it. I wonder why.

Here's what I'm doing:

Code: (hlsl)
struct VertexInput
{
  float2 vertexPos : POSITION0; // from vertex data
  float3 targetPos : TEXCOORD0; // everything else is from instancing data
  float2 size : TEXCOORD1;
  float4 texsource : TEXCOORD2; // texture atlas area, xy topleft, zw size
  float4 colour : TEXCOORD3;
  float2 param : TEXCOORD4; // x is rotation, yz is handle position
}

struct VertexOutput
{
  float4 pos : POSITION0;
  float4 colour : TEXCOORD2;
  float2 tex : TEXCOORD0; // texture coord
  float4 texArea: TEXCOORD1; // texture clamping area - xy topleft, zw size. We need to stay inside that to stay clear of interpolation artifacts
};

.....

// in the vertex shader, determine which scale is going to be used by dividing screen size by tex source size
float borderSize = min( inp.size.x / inp.texsource.z, inp.size.y / inp.texsource.w);
// round down to next power of two
borderSize = exp2( floor( log2( borderSize)));
// calculate the number of texels we need to stay away from the border. For highest mipmap level,
// 0.5 texels is enough to avoid interpolation artifacts, each further mipmap level needs twice that area
// but limit it to some sensible maximum
borderSize = 0.5f / clamp( borderSize, 1.0f/16.0f, 1.0f);
outp.texArea = (inp.texsource.xyxy + float4( 0, 0, 1, 1) * inp.texsource.zwzw + float4( 1, 1, -1, -1) * borderSize) * gInverseTextureSize.xyxy;

......

// then in the fragment shader, simply clamp the texture coordinate to the calculated texture area
// so that whatever fragment we render, interpolation never takes samples from outside the source texture area into account
float2 texk = clamp( inp.tex.xy, inp.texArea.xy, rein.texArea.zw);
float4 texel = tex2D( TexDiffuse, texk);


Quickly translated from my german shader code, so it might contain errors. But it's really that simple, I really wonder why nobody else is using it. I draw tens of thousands of sprites with this, arbitrarily scaled, rotated, positioned with subpixel accuracy, and there are no interpolation artifacts visible. The downside is that you'll need to come up with a better mipmap level calculation - the one given above is obviously aimed at 2D sprites only. But I'm pretty sure you can find some calculation that safely overestimates the mipmap level, especially when you're not bound to DX9 shaders like I am currently.

For starters, you can simply leave out the mipmap level calculation and use a fixed 0.5 texel offset from the border. That way you should be able to use at least bilinear filter and/or AntiAliasing. MipMapping will still come up with artifacts, though.
« Last Edit: January 03, 2013, 03:22:54 PM by Schrompf » Logged

Let's Splatter it and then see if it still moves.
BleakProspects
Level 4
****



View Profile WWW Email
« Reply #215 on: January 03, 2013, 04:43:49 PM »

Of course, what a great idea! Got AA working now:

Logged

BleakProspects
Level 4
****



View Profile WWW Email
« Reply #216 on: January 05, 2013, 03:34:43 PM »

Mining a home in a snowcapped mountain:


I've been working on performance a bit, and have been making the way I generate chunks/biomes more streamlined by defining a biome in a data structure (previously I just had horrible switch statements and hardcoded values everywhere).

Logged

Impmaster
Level 10
*****


Scary, isn't it?


View Profile WWW Email
« Reply #217 on: January 05, 2013, 10:17:58 PM »

You are now my idol.


Just wondering a few things.

How long have you been coding in general?

Are you making your own engine?

What platforms will this be available upon?

What language does it use?

How much money will you accept from us?
Logged

Do I need a signature?
Ninja Derpify
Level 0
**


View Profile
« Reply #218 on: January 05, 2013, 10:36:33 PM »

Oh man, I am very excited about this!  Addicted
Logged
BleakProspects
Level 4
****



View Profile WWW Email
« Reply #219 on: January 05, 2013, 10:54:55 PM »

How long have you been coding in general?

In general, I think it's been 7 years. This language, like 4 years. This project, since June or July.


Are you making your own engine?

Aside from it being in XNA, yes. I started with a spinning cube. After the first day, it looked like this. I was following this tutorial by the guy who made Vox.

What platforms will this be available upon?

Windows only for now. It might be possible to port to XBOX later but this game would not work well on that platform. Mobile or Mac is also unlikely without some extreme work (I would probably end up porting it to Unity, which might be a headache.).

What language does it use?
C#. HLSL shaders. XML data files.

How much money will you accept from us?

I haven't started talking about funding yet. When the game is actually a game and rather than a toy I will probably release a small alpha for $1 and use the alpha-fund model. The game will gradually increase in price as it grows more complex. Of course, I could always accept donations Wink The project is a hobby (I have a day job).
Logged

elija
Level 0
**


View Profile Email
« Reply #220 on: January 05, 2013, 10:58:59 PM »

Seeing this thread for the first time, just wanting to say, looks very nice - lots of love in there.

Keep it up!

Elija
Logged
sublinimal
Level 8
***



View Profile
« Reply #221 on: January 06, 2013, 05:04:37 AM »

Glad you're back. The last few shots look promising for sure.

Like, there's micromanagement that allows you to build elaborate structures, but you also have automation for the mining and such. The perfect scope for a building game.
Logged
Ragzouken
Level 0
***



View Profile WWW Email
« Reply #222 on: January 06, 2013, 05:19:44 AM »

This is really beautiful! Do you have any plans to have ramps/slopes (like in DF) to make the terrain smooth?
Logged

Joshua
Level 5
*****


Be rad to one another!


View Profile WWW Email
« Reply #223 on: January 06, 2013, 08:07:45 AM »

You may wish to check out MonoGame, it seems like a fairly straight-forward way of porting XNA based projects to many platforms.
Logged

Pineapple
Level 10
*****


Love, love is a verb Love is a doing word ~♪


View Profile WWW
« Reply #224 on: January 06, 2013, 07:15:49 PM »

You are now my idol.

BACK. OFF. Bleak only gets to have ONE creepy stalker-ish fan, and that's ME. BITCH.
Logged

Pages: 1 ... 13 14 [15] 16 17 ... 49
Print
Jump to:  

Theme orange-lt created by panic