Archiv der Kategorie: Allgemein

Unity Skybox Gradient Shader without Banding

AGameHasNoName

Our new project

A new game. A new shader

Aga and me are currently working on a new 3D Unity game. You can see the progress on our tumblr.

Last week I’ve been tweaking a three color gradient skybox shader. It works fine with bright colors but when you go dark, ugly banding appears. The visibility of the artifacts depends on light conditions. You may not see it in bright daylight but if you’re looking at it in the evening it becomes quite obvious:

Gradient

The original shader code just lerps between colors which leads to banding.  Believe me. It can really stick out on your iPhone.


Noise to the rescue

Thankfully Matthew VanDevander pointed me in the right direction and after searching the web I found a playground dedicated to banding elimination on shadertoy.

I extracted the ScreenSpaceDither noise function and transcribed it to Unity:

const float noiseScale = 240;
const half noiseIntensity = 1;

float2 wcoord = (i.worldpos.xy/i.worldpos.w) * noiseScale;

float4 dither = ( dot( float2( 171.0f, 231.0f ), wcoord.xy ) );
dither.rgb = frac( dither / float3( 103.0f, 71.0f, 97.0f ) ) - float3( 0.5f, 0.5f, 0.5f );

I didn’t test performance and maybe simpler noise functions are sufficient as well but I am really pleased with the result. By the way: You can tweak noiseScale and noiseIntensity to your liking.


BandingLight

without dithering

NoBandingLight

with dithering

Complete shader

Shader "BOX/3 Color Dithered Gradient Skybox" {

Properties {
_ColorT ("Top Color", Color) = (0.0, 0.0, 0.0, 0)
_ColorB ("Bottom Color", Color) = (0.0, 0.4, 0.4, 0)
_ColorR ("Right Color", Color) = (0.73, 0.34, 0.34, 0)

[Space]
_IntensityR ("Right Color Intensity", Range (0, 1)) = 0.5

[Space]
_Direction ("Direction Bottom", Vector) = (0.18, -1.64, -0.19, 0)
_Direction2 ("Direction Right", Vector) = (1.42, -2.26, -0.50, 0)

}

CGINCLUDE

#include "UnityCG.cginc"

struct appdata {
float4 position : POSITION;
float3 texcoord : TEXCOORD0;

};

struct v2f {
float4 position : SV_POSITION;
float3 texcoord : TEXCOORD0;
float4 worldpos : any;

};

half4 _ColorT;
half4 _ColorB;
half4 _ColorR;
half3 _Direction;
half3 _Direction2;

half _IntensityR;
half _Exponent;

v2f vert (appdata v) {
v2f o;
o.position = mul(UNITY_MATRIX_MVP, v.position);
o.texcoord = v.texcoord;
o.worldpos = o.position;
return o;
}

half4 frag (v2f i) : COLOR {
//Gradient
const half exponent = 2;
half d = dot(normalize(i.texcoord), _Direction) * 0.5f + 0.5f;
half d2 = dot(normalize(i.texcoord), _Direction2) * 0.5f + 0.5f;
float4 gradient = lerp (_ColorT, _ColorB, pow(d, exponent));
gradient = lerp (gradient, _ColorR, pow(d2, exponent) * _IntensityR);

//Noise
const float noiseScale = 240;
const half noiseIntensity = 1;
float2 wcoord = (i.worldpos.xy/i.worldpos.w) * noiseScale;
float4 dither = ( dot( float2( 171.0f, 231.0f ), wcoord.xy ) );
dither.rgb = frac( dither / float3( 103.0f, 71.0f, 97.0f ) ) - float3( 0.5f, 0.5f, 0.5f );

return gradient + (dither/255.0f) * noiseIntensity;
}

ENDCG

SubShader {
Tags { "RenderType"="Background" "Queue"="Background" }

Pass {
ZWrite Off
Cull Off
Fog { Mode Off }
CGPROGRAM
#pragma fragmentoption ARB_precision_hint_fastest
#pragma vertex vert
#pragma fragment frag
ENDCG
}
}
}

Another tidbit: You can’t use SV_POSITION directly on iOS because it will always be (0, 0, 0, 0). It took me a day to find out why the shader worked fine in the editor but did nothing at all on the device. The workaround is to write the position to another variable in the vertex shader.

Veröffentlicht unter Allgemein, Indie Games, Unity | Verschlagwortet mit , | 1 Kommentar | 1376 views

Short notes

2 Dreams will be shown at AmazeFest next week. It made the Shortlist for the „Most Amazing Game“ by the way.

I am working on a new project: Rules! If you want to learn more about it you can meet me at AmazeFest or watch the first episode of „Monkey Business“ where Martin Pittenauer (@map) is documenting the work at German Game Studio TheCodingMonkeys (Carcassonne, Lost Cities).

 

Veröffentlicht unter 2 Dreams, Allgemein, Indie Games, Rules!, Text, Video | Hinterlasse einen Kommentar | 41 views

2 Dreams – Game Design Dojo

The first reviews of 2 Dreams are coming in:

 writes for 148Apps.com: “Surreal, unique, and original, 2 Dreams is an intriguing narrative adventure puzzler that is a special kind of game.” I really love the depth of the review. It’s meaning a lot to me.

Owen Faraday did a little interview on Pockettactics and says: “We’re talking about 2 Dreams, his surreal new iOS game — his first video game — and 2014′s most inventive game yet.

On the German site Fritz.de they say: “2 Dreams ist nicht nur clever, der Nerd-Humor ist auch wirklich unterhaltsam.“ (2 dreams isn’t just clever the nerd humor is really entertaining).

There are some people who pointed out similarities to Device 6. I had not been aware of this app until very recently but I have to admit it is the same gerne. If anybody can claim this genre even exists: A narrative reality bending puzzle adventure.

Several weeks ago I gave a talk about the development of the game. I had caught me off guard that I had to hold it in English so please prepare for a bumpy ride.

P.S. I am working on my next project at the moment that maybe a fresh take on the infamous Eliza experiment. Stay tuned.

2 dreams support mail: zeitweise@137b.org

Veröffentlicht unter 2 Dreams, Allgemein, Indie Games, Text, Video | Hinterlasse einen Kommentar | 38 views

Struggles

Draft is now pixel perfect on iPad, iPhone 5 and iPhone 4. That was a tough choice because I had to resize all graphics and redo much of the stuff. This is a scene further into the game. I experimented with new elements. Some screens will be played in more or less complete darkness. I hope this screenshot shows the variety of locations Draft will run into.

I’ve not been posting for a couple of weeks now. Is Draft dead? Not at all. But I had a rough time regarding the game. The last three weeks were packed with events I’ve been attending. First the AMaze festival which was really great and one week later Re:publica where I had to do a talk together with Agnes Lison.

Instead of having time to actually work on my game I had the opportunity to gather feedback at least. People at AMaze were really helpful and made me reconsider much of the stuff I put into the game until my last blog entry. Well, I had to cut most of the introduction because it seemed to confuse people. Digging further into feedback I made some other big decisions regarding how the user interface works. The timeline now shows all movements and I put hints into the game when Draft will be jumping. Another decision: The player now can adjust the platforms throughout the complete level. Formerly this was only possible once per level.

At first my goal was to make another demo for this week but I could not finish it. I am still hoping you will be able to play the current version next week.

Veröffentlicht unter Allgemein, Bild, Draft, Indie Games, Text | Hinterlasse einen Kommentar | 14 views

Introduction

This week I’ve been working hard on a playable demo that I’ll be able to show next week at Indie Connect in Berlin.

The game now starts at dawn. Added additional lighting and animated fog.

I’ve put my emphasis on how to teach the game mechanics and introduce character and story at the same time. That’s always tricky. How do the mechanics I invented even fit into a storyline? What happened in this little platformer world that Draft is so disoriented that she jumps into holes and walks against walls so the player has to help her? I did not want her to look stupid or getting the player frustrated over her actions.

So I tossed several ideas around. Should I directly jump into gameplay or having a large cutscene? I always like games that give me the possibility to interact as soon as possible. Especially on iOS where you often play at bus stops or during a lunch break.

My current result is a mixed approach. With their first action the players get sort of responsible for Draft’s fate. They did this to her. And I hope that’s getting them involved.

And another side effect: While teaching the players what to do I am explaining Draft’s weird behavior en passant. I do not know if this is the best possible solution. Feedback will tell and I am always willing to change things.

During Feedback Friday you are able to play the demo via reddit (Unity Web player needed).

P.S. I thought it would be a good idea to share games with you that I am currently playing or am especially fond of:

  • Thomas was alone (Steam) – Sometimes quirky but over all a very likeable approach
  • Badland (iOS) – Multiplayer (on iPad) is as much fun as single player
  • Starseed Pilgrim (Steam) – It’s quite a Zen like experience to dive into this game without any explanation
  • Magnetized (Web) – Cool new idea for a one button game
Veröffentlicht unter Allgemein, Bild, Draft, Indie Games, Text | Verschlagwortet mit | Hinterlasse einen Kommentar | 16 views

Draft

As you might know I am working as a board game designer since 1997. I thought about also making video games in the past, but I never got this thing started.

Until now. Well, I am finally working on my first independent iOS game. It’s an ”inverse“ platformer (more to that in the future) called ”Draft“. I also setup a dedicated Twitter account (@sightwise) that will tweet in English about indie game related stuff.

After toying around with some Frameworks (like Sparrow) and Game Engines (like Unity3D) for a couple of weeks I decided to do all the heavy lifting with Unity. Sparrow would have been my first choice for a project like 137b Avatar nowadays where I could easily put OpenGL into a native Objective-C project. It’s a different thing for a game like ”Draft“ where a graphical user interface comes quite in handy for working on the content. Unity is excellent for fast results so that choice was not a hard one.

Peciuliar enough Unity doesn’t provide a good 2D character controller and most of the stuff I found on the internet was rather clumsy or half finished. I had to write one by myself. I used the Physics FPS Controller as a base and built on it. The hardest problem seemed to be the character sticking on to walls so I had to introduce some raycast magic. Maybe I will release some code somewhat later, when I’ve polished my messy code.

By the way: For the 2D sprite stuff I am using Toolkit 2D and Photoshop which really helps to setup things quickly.

To be continued…

P.S. Here are some indie games links I frequently visit:

Veröffentlicht unter Allgemein, Bild, Draft, Indie Games, Text | 1 Kommentar | 25 views

Smartbook – Analog ist das neue Digital

Ein Smartphone.
Ganz aus Papier.
Ja geht das denn?
Ja, geht.
Aber das haben wir noch nie so gemacht.
Stimmt.

Das Smartbook.


Telefon

Weiterlesen

Veröffentlicht unter Allgemein, Bild, Mac, Satire | Hinterlasse einen Kommentar | 50 views

Santa Cruz ist das Spiel der Spiele 2012

Mein aktuelles Brettspiel Santa Cruz hat nicht nur den Sprung auf die Empfehlungsliste zum Spiel des Jahres 2012 geschafft, jetzt wurde es mit dem Österreichischen Spielepreis ausgezeichnet und darf sich mit dem Hauptpreis Spiel der Spiele 2012 schmücken. Ich freue mich und will in diesem Zusammenhang einen kleinen Einblick in die Entwicklung des Spiels geben.

Spiel es noch einmal, Sam

Die meisten meiner Spiele erfinde ich um Neujahr herum. Es ist eine Zeit, in der ich mehr zur Ruhe komme und im Kreis der Familie die Gelegenheit habe Spielideen auszuprobieren. Konstant an Ideen arbeiten zu können blieb bislang ein unerfüllter Traum. Mal fehlte die Zeit, mal fehlte das Geld, manchmal beides. Und so liegt mein Spieleoutput pro Jahr konstant bei nur wenig mehr als einem Prototyp.

Die Entwicklung meiner Spiele beginnt selten mit einem Thema oder Mechanismus. Klar kommt das vor, aber meist geht es mir um die Dynamik zwischen den Spielern. Die Blicke, die feuchten Hände, leere Drohungen, Gelächter und Sticheleien. Was passiert im unsichtbaren Raum zwischen den Spielern – wie interagieren sie? So auch bei Santa Cruz. Die grundlegende Frage, die ich mir stellte war: Was, wenn ich ein völlig ungerechtes Spiel entwickele und den Spielern die Aufgabe übertrage, selbst Gerechtigkeit zu schaffen? Was, wenn ich sie in eine unüberschaubare Situation hineinwerfe, ihnen aber die Gelegenheit gebe, ihre Fehler im zweiten, dritten oder vierten Durchgang zu korrigieren?
Weiterlesen

Veröffentlicht unter Allgemein, Bild, Brettspiele, Text | Verschlagwortet mit , , | 3 Kommentare | 193 views

Die Türsteher vom Club „Kultur“

Ich bin fassungslos. Der Türsteher vom Club „Kultur“ durchwühlt meine Tasche. Er sagt mir, wann ich zu tanzen habe, wie ich zu tanzen habe. Keine Flaschen vor der Tür. Warum er das darf? Er stand immer schon da.

Bei der Debatte um Urheber- und Verwertungsrechte geht nicht darum, Künstler in die Gosse zu werfen, genauso wenig wie es beim Atomausstieg darum geht, Kernkraftwerksmitarbeitern Haus und Hof zu rauben. Der Kampf ums Urheberrecht ist ein Kampf der Privilegierten. Ein Kampf der Verwerter. Ein Kampf um tradierte Geschäftsmodelle. Ein Kampf um Einnahmequellen. Ein Kampf derer, die jetzt von ihrem kreativen Schaffen leben können und Angst haben. Angst, dass sich etwas ändert, Angst, dass sie neue Wege finden müssen; Wege, die ungewiss sind. Angst ist verständlich. Ein guter Berater ist sie nicht.

Weiterlesen

Veröffentlicht unter Allgemein, Piraten, Politik, Text | Verschlagwortet mit | 24 Kommentare | 23 views

Spielwarenmesse 2012

Als kleinen Vorgeschmack zur bereits laufenden Spielwarenmesse haben Andrea Meyer, Hans-Peter Stoll und ich vor zwei Wochen einen Podcast aufgenommen, in dem wir über die Spieleszene allgemein, unsere Neuheiten und ein bisschen Spielephilosophie sprechen.

Enjoy:
Spieleautorenpodcast (m4a)
Spieleautorenpodcast (mp3)

Mehr Infos zu Santa Cruz:

Veröffentlicht unter Allgemein, Audio, Brettspiele, Podcast | 1 Kommentar | 10 views