Tree Band Problem

David fixed the issue with the floating branches when you merge the tree. Mostly it had to do with getting quaternions right to handle the correct rotation.

We had another problem though, with the bands on the tree:


These are only supposed to appear at the base of the tree to indicate how many fruit cubes grow from it. I think Chris wrote the script so that it should only go on the trunk part, which should be separate from the rest of the tree.

Anyway, right now it is getting applied to the entire tree.

Leaf Outline

Quote from: Zorg on April 03, 2015, 05:20:27 am

I thought about the missing outline of the leaves. In the screenshots in some areas it’s hard to tell which cube is in front of other cubes. Which is not necessarily bad! I guess it’s very clear in motion. With these very bright leave colors i thought about a white outline for leaves, but in a mockup it did not turn out very well (i’ll show it anyway): Wink

First of all, thank you so much for taking the time to do the mockup! Really appreciate.

I actually don’t think the white outline looks that bad. I an see it conflicting a bit with the lighter-colored leafs, like yellow, but I think here for red, it looks quite nice.

I noticed that leaves do not drop shadows, which may result in a shadow image of a “dead” tree on the walls. It would look better with a shadow, imho:

Ya, the lack of shadows from the leaves does bother me…

So after seeing Zorg’s points about outline and shadows, I decided to do a bit of an experiment on twitter: twitter leaves comparison

The response was overwhelmingly in favor of having outlines. Something like 20 to 2.

One thing that I hadn’t considered, and I think what’s great about the outlines is that it causes outlines *not* to be drawn through them. This is because of the order in which the transparency is rendered. By rendering the leaves in the order in which outline is drawn on the leaves, it means it’s blocking the objects behind it, and hence outlines are now drawn on those.

As a result, the leaves hide the the outlines of the branches inside of it, so when you’re looking at a large scene, it makes it much less cluttered.

Compare below:



Without the leaves hiding the branches, the outlines there get all bunched up together, and actually makes the trees look rather ominous. By outlining the leaves, the tree looks much fuller and well-defined.

One thing I also changed was the make the inactive leaves more white instead of grey:


I think it makes the inactive leaves look like they’re lamps that are turned off, which is pretty cool. I can see this lending itself to some really nice aesthetic opportunities, like making an area that looks like a empty street at dawn or something.

Relativity_Game_Screenshot-2015-04-03_15-58-55 Relativity_Game_Screenshot-2015-04-03_16-40-54 Relativity_Game_Screenshot-2015-04-03_16-41-06 Relativity_Game_Screenshot-2015-04-03_16-41-21 Relativity_Game_Screenshot-2015-04-03_16-41-13 Relativity_Game_Screenshot-2015-04-03_16-41-56

Here’s a close up of the shadows:Relativity_Game_Screenshot-2015-04-03_16-19-27

While I like that there are now shadows, I’m not a fan of the pattern that’s on it. I wish it were just a lighter color of the other shadows, but still solid. Not sure why this is happening. Will look into it some more.

Different Gravity Trees

Got trees for different gravities working. It’s all in one big sandbox level for me to test that the mechanics are working together, hence why this level looks so ugly.

Also, will need to spend some time tweaking the colors. Will need to find good balance between aesthetics and function.

1 2 3 4 5 6

Leaf Shader

Leaf Shader

I spent all day yesterday trying to debug this annoying problem with the shader for the leaves in the game. It was one of those debug sessions where you try all these crazy complicated solutions and go down many rabbit holes, and after many many fruitless hours, just when you’re about to give up, you find that the solution by commenting out two lines of code.

Yes, yesterday I fought the shader dragon, and it turned out to be a dragonfly. But I won (!), so I guess it’s all good.

Anyway, gather around my friends, and I will recount the tale of my majestic (mis)adventure!

The Problem

Here’s what the leaf in the game looks like, when Unity is in the PC platform.

Relativity_Game_Screenshot-2015-03-17_00-34-43 Relativity_Game_Screenshot-2015-03-16_17-04-36

Notice how in certain angles, you can see the back face of the block, which makes for a slightly darker alpha area. I really like this effect, because it reminds of when you’re doing watercolor, and you color over an area that’s already been colored. It also adds a nice variation to the color, preventing it from looking too uniform, and also adds a nice sense of 3D.

Also, what’s great is that it responds to changes in lighting:


However, when getting it to run on PS4, I end up with the nightmarish pink that’s all too familiar to anyone who has done graphics programming:


Approach No. 1

My initial thinking was that it was because this shader is a surface shader, and I can’t used fixed-function pipeline shader, so I decided to try to convert it to a vertex fragment shader.

For surface shaders in Unity, if you add the line

#pragma debug

Then in the inspector, when you hit “show generated code”, it’ll show you the vertex fragment version of the surface shader:

shader inspector

The script that was generated though, was over 1,000 lines long and I really couldn’t figure out the logic of what was going wrong.

Approach No. 2

I decided to try to just write a vertex fragment shader from scratch that had the same effect.

Here’s the progress of it:

Relativity_Game_Screenshot-2015-03-24_19-47-21 Relativity_Game_Screenshot-2015-03-24_23-07-17 Relativity_Game_Screenshot-2015-03-24_23-31-11

I was able to get both front and back faces rendered transparently. In the second picture above, you can see that for the red box on the left, you can see the grids on both the front and back faces.

However, I wasn’t able to get different alpha values on the different faces (ie. using the normals), and also couldn’t get the coloring to respond to lighting.

I soon realized the reason why it’s so great to work with surface shaders is because it takes care of all the lighting issues that you’d have to write yourself in a vertex fragment shader, which is very complicated.

Just FYI, I was using this shader on multiple lighting and this one on translucent bodies as references from the Cg programming wikibooks. They’re both great examples, but I wasn’t able get the effect I wanted.

Approach No. 3

I gave up on writing a vertex fragment shader and decided to try to use Unity 5′s new standard shader model.

The problem is that it seems that the rendering order has changed. Now, it renders transparency before post-processing, so you can see the line is drawn on top of the transparent object:


Whereas in the previous shader model (still available in Unity 5 as legacy shaders), render transparency after post-processing:


In any case, I couldn’t figure out a way to directly edit the standard model shader script, so wasn’t able to add back face rendering.

Approach No. 4

It was around 4 AM in the morning, and I was pretty much ready to give up. I thought I’d just go with the legacy shader transparent material. It didn’t have the nice back face rendering that the original shader had, but it was close enough.

As a last resort, I decided to comment out the second pass of the original shader, and all of a sudden it worked. So it seemed like the problem was just due to the second pass in the script. I then started to do a trial and error approach, commenting out different sections of the code until eventually, I commented out this:

ZWrite On
ColorMask 0

And boom! Lo and behold, it worked! This is a screenshot taken from the PS4 devkit:

Check out that sweet back face rendering and layered alpha!


Bonsai Tree Design

Continuing to work on bonsai tree designs. My plan at the moment is to create 100 of these, and then pick the best ones to randomly place throughout the game.

Some people have suggested writing a script to generate these trees, but the thing is, I still haven’t figured out the pattern behind the bonsai trees, and I think it’d actually be more work to come up with that script and tweak it.

Besides, it is pretty fun to make these.

Here are some images:

A21L9t7 2 3

Also, if you ever work with reference images, I highly recommend getting Kuadro. It’s an image viewer for windows.

It’s incredibly useful, and lets you do things like set an image to be “always on top”, so you don’t have to switch between applications when modeling and drawing something. It’s basically an app that I’ve wanted for the past 2 years.



Also, finally found the style of waterfall that will be in the game.

This one from Wind Waker is really close:


Here’s a thread about recreating it in Unreal:

Here’s a thread on doing it in Unity:

I put together a rough mock up of it to see how it’d look in the game. The color is all off, but I think it’s promising:


Also, Wind Waker seems like an incredible technical achievement for its time:


DevLog Update – Big Picture, Audio, and Trees

For the last few days, I’ve been working mostly on high-level design stuff such as back story and game progression structure. The game is definitely coming together, and it’s really helpful to see the big picture, but it’s also overwhelming at the same time to see how much there is still to do.

Also met with my friend Kiku Hibino, who will be doing the audio and music for the game. We’ll do a proper intro for Kiku in a few weeks, when I can get him to write something up about himself. Looking forward to using original sounds and music in the game instead of placeholders.

I spent today listening to the Tron: Legacy soundtrack and designing trees. I have 5 different types now, which should be enough for the moment:

Here’s an attempt at a tree-lined street: