Thursday, 27 March 2014

Final Stretch

The last week (maybe 2?) of classes is fast approaching and it's crunch time to the extreme. Our studio has to pass the second GDW gate next week, keep working on 3 reports, a sound project, and independent architecture, accounting, and graphics homework. That's a lot to keep track of!

Ambient Occlusion attempt
I tried out some AO in Maya the other day and it turned out pretty sweet. The model was not created by me originally and I hadn't realized that the normals weren't softened first, so it turned out a little liney. I would've done it again (and will do so if it's used in our game) but it took about 15 minutes to render the first time and I had things to do :-P The nice thing about AO, at least in it's most basic form, is that coding it is so easy; just multiply the AO texture by the regular diffuse texture and it deepens the shadows quite nicely. Except for those darn lines!

Assembly... gah
On another note I've also been working in MIPS assembly for my Architecture class. It had.... one hell of a learning curve, I'll give it that. I'm still a little shocked I got it all to work. Basically, I did a whole bunch of research to do this first as I was making a class that accepted an array, size n, and int x. The program goes through the whole array and adds to a sum if array[i] is equal to x. EASY stuff in C++, C, heck even in Flash, but in MIPS it was extremely tricky to wrap my head around for a long while. This isn't all the code obviously but it's the bulk of the for loop and if statement. It was kind of relaxing to work in a lower level code though to just look at something different and try and solve a super simple problem with a lot of hard work, just like coding in C++ used to be when I was learning it.

That's all for this week. Back to working on... everything!

Thursday, 20 March 2014

Sudden Progress!

Finished dragon head (tada!~)
My little pride and joy, this dragon head. I finished it in only like 3 days, so while I'm sure it could have some better geometry a better method of having the jaw open then making it a seperate object I'm super happy with what I came up with in such a short time. I hope to bump map it all over the place as this enemy is going to be nearly the size of the scree and such a detail would really make it pop.

Other than this lovely model I've also been working hard to incorporate normal mapping into our game while accounting for multiple normal maps for different objects. The way I worked around this small problem was by changing what texture was at GL_TEXTURE2 (which is being used for normal mapping) before rendering each individual model. This way the right normal map applies to the right model. There may be a better way of doing it, but this certainly seems to work just fine :-)

Our studio also finally reincorporated the menu we had so long ago but haven't seen in months because of this semesters reframeworking. Now it's back! This week I'm focusing on normal mapping all of our models, even if that means loading them in Mudbox and creating a 'blank' one for our game to load, as well as helping out with the creation of the boss level. Busy week!
but always time for music

Thursday, 13 March 2014

Steady Progress

Tangent Normal Shader
It's been yet another hectic week as I finished up my last midterm (finally!) and have started programming and modelling like mad. I've been trying to focus a lot on some Graphics homework questions to try and get them out of the way and potentially into our game before the end of the month. For the past couple of days I've been working on a normal map shader as seen above. Oddly, I found making one in tangent-space easier then one in object-space, but that must be because no one in online forums has any advice for object-space. Kind of shows how tangent-space is better!

Shader Code~
The code above is pretty simple for creating normal maps, or at least a lot more simple then I would have anticipated. Obviously, the normal of the point is what is affected, which in turn affects how the lighting is calculated for that point. Using the position and the texcoord of each point, the tangent is found pretty easily (credit to imbusy from http://www.pouet.net/topic.php?which=6266 for the calculation of the TBN matrix). In order to return the normal to world-space from tangent-space multiply the Tangent-Binormal-Normal matrix by the normal map that was created earlier in the code. This way the normal map applies to each normal, insuring the light is affected in the way the normal map intended.

Final Boss - WIP
Aside from some rather frantic coding I've also been doing a lot of last minute model work. Above is the dragon head I've been working on as a final boss for our game. I still have to add the teeth to the bottom jaw and sculpt the inside of the lower mouth, as well as whip together a simple texture, but I'm super happy with how the upper head turned out so far! If time allows I'm also going to give him some head armor reminiscent of our main character, but there is a fair chance I simply won't have time. I'm in charge of the whole boss level where the player gets eaten up by this dragon head and spends the level inside his body, dodging bones and ooze while trying to slash at his heart. That's a dragon head, heart, level walls, and falling bones I have to model in about 4 days if you weren't keeping count! I'm up for a challenge but this is a bit much on my birthday weekend :-P

This is the first model I've made with a functional mouth, so it's taking significantly longer than if the mouth was closed. By significantly, I mean I was finished modelling the base after 2 hours before I had to cut it in half and keep going. It's lovely practice though and I appreciate any chance I can get to try something new in Maya, so I'll persevere I'm sure!

Tuesday, 4 March 2014

Long Time No See!

It's been too long~

It's been quite a while since I last posted anything, my bad! I took Reading Week off to study, unwind, sleep; the usual. After that was the week of midterms and I just completely forgot about blogging. I'll try to make it up this week and, now that I've remembered about blogs, I certainly won't miss another one! (we hope)
Mole Enemy
This week I've been pretty busy in trying to create some more content for our game. I mentioned on a previous blog that I'd been working on this little mole guy and he's now fully modeled and textured. I think he turned out pretty good and I'm looking forward to seeing him implemented in the game as the little nuisance I imagine him to be >:]

Bird Enemy (WIP)
 The other one I've been modelling for the past couple of days is just a semi-realistic, eagle-type bird I based off of some real photographs. I plan on texturing him in the same manner as the other enemies to help tie them together; vibrant colours, chunky textures, painterly shadows. He'll probably be a reddish-brown with a bright yellow beak and eyes. He drops things on the player, probably rocks, as he flies through the level and pesters the player. I seem to like enemies that really annoy our poor player, whoops.

Other than these two models, both of which I'm pretty proud of for different reasons, I also recreated the font for our UI and menus so they were higher quality and a little less... curly.
Screenshot of our Toon Shader

Toon Shader Code

Above is a screenshot of our protagonist model being lit with the simple Toon-style shader that our Lead Programmer Mark has been working on. It's not 100% definitely the shader we'll be using, but it looks pretty sweet! I think adding outlines would detract from the aesthetic of the game that we have going so far, so the other option would be a more realistic lighting over this Toon shading. We also plan on adding some form of bloom in game and rim lighting behind the main player, but we will definitely (read: hopefully) having the lights move throughout the day/night cycle that our backdrop goes through. The colour of the light will also adjust depending on the time of day, such as a cool, bright blue for night lighting and a vibrant yellow-white for regular sunshine.

The code is actually stupidly straightforward in how it creates the sharp contrasting shadows. Depending upon the degree of diffuse lighting on an area of the model if it's within a certain range, it's set to one value. ie if the diffuse value of a point is between 0.0 & 0.2, it is set to a factor of 0.2. This makes that sharp contrast between a 0.2 and a 0.5 area, for example, as there are no values in-between that remain visible. The colour of the light is also applied at this stage, and the specular calculated for the shiniest of areas.

All in all, our game is coming together nicely if at a slower pace then I'd like. But it's crunch month! If there's such thing as just the right motivation to finish our game, it would be known as Crunch Month~

Wednesday, 12 February 2014

Shader Experiments!

Yesterday I realized I sat down and worked on one shader for over 6 hours for one of the homework questions... when you look up from your monitor and the room is pitch dark it's time to take a break. The shader I was working on was actually very very simple, just a fragment based one that can implement a texture and a specular map. However, I was having a lot of problems because of the program I was working in that I still haven`t resolved.

I was working with OpenGL Shader Designer, a cool little program that lets you see how your shaders would look in realtime without having to write all the base code (viewports, rotation controls, etc.). It just lets you put some textures in there and loads up one of a couple of default meshes for you to work with. Super cool idea! Not so great in practice.

I continually ran into issues that I couldn`t resolve without access to the base part of the program (not the .vert or .frag) but that wasn`t included in the software, meaning I was constantly finding work arounds. The other problem was a lot of the syntax we learned in class had to be thrown out the window because the software works in version 1.8ish. It never actually said what version, but whenever I tried something from the newer version it would yell at me in confusion.

Final sphere result

So in the end this is what I settled on as being good enough. I was tired of working on it and the thought of trying to add in displacement/normal mapping... again.... *shudder*

I'm pretty pleased with it overall though, it's a fairly basic Phong shader that ought to have a specular map but for whatever reason doesn't show it. I honestly think that's a flaw in the software though, not my shader's code. I guess I'll find out when I get our TA to take a look at it on Thursday/Friday but it was such a pain in the butt I doubt I'll finish it up unless it's the easiest fix.

On the plus side, this has really helped reinforce all the practical stuff we've learned in Graphics this semester. Before yesterday shader programming was a huge mystery to me, not with the theory but the code itself. It still boggles my mind where this information comes from to get into the program but hey, who am I to argue if it works!

Code Screenshot (.frag)
I might as well talk a little bit about the code! I thought it's about time for a more hardcore blog. Rather than going into full detail, as that would take... a while, I'll just explain the basics of the program. In any shader that takes lighting into account, the 3 main types of light need to be considered: diffuse, ambient, and specular. Specular was what I dealt with most in this particular .frag as I was trying to implement a specular/gloss map. The map that I was using was loaded on line 26, with "vec3 glossTexel = normalize(texture2D(texture2, gl_TexCoord[0].st).rgb & 2.0 - 1.0);". This line gets the texture from within gl_TexCoord as a 3D vector, then normalizes it. Calculations are done to determine how the object interacts with diffuse lighting and how it's affected by the glossiness, and the specular lighting and how it's affected if the shininess is > 0.0;

Side note: f this is considered a 2/2 blog, and my other ones all aren't, please let me know! I'd really like to know what is being looked for in order to do well in this portion of the course, and without feedback we're all feeling rather in the dark. Even just a heads-up of how many points we all have so far would be super appreciated!! :-)





Tuesday, 4 February 2014

Another Day Another Post

This week I've been doing some work on a new model for our game, based off of our Lead 3D Artist's design from the start of the year. It's got a really nice silhouette and was a lot of fun to make without being as stressfully complex as the humanoid model I made last semester.
Mole Dasher concept
I've been modelling this guy and it's been nice to get back into Maya and remember everything I'd picked up this year. I was certainly rusty after a month and a half break but I got back into it soon enough. I'm not using my laptop right now or I'd take a screenshot of the model. It's all covered in reference colourful texture anyway so it's pretty bizarre looking.

I also did some more work on the backgrounds for the game. We plan on having a scrolling vertical background that fades from one sky to the next, like a randomized day-night cycle.



So far I've been mostly building up our assets each week, but school work for every class has had me (and the group) pretty swamped. I work part-time too, meaning I have very little time to work on our game. But when I do I make sure to do it in bulk! I'm planning on starting another model in the next few days, an enemy bird that drops bombs (maybe eggs?) onto the player. Simple concept that I think would be really fun to model. Legs & arms are the worst part of modelling for me, so anyway I can avoid them the better.

Time for GDW, guess I better get going!

Monday, 27 January 2014

Little Update

There's not too much to say this week and my notes aren't very good for a blog, so this one's going to be short and sweet! Sometimes it's nice to just get a few ideas off the top of my head onto paper rather than making this into some long-winded update or talk about notes for the week.

Tomorrow we have our first review in GDW for the Winter 2014 semester. So far our lead programmer has done a lot to improve our framework over the previous semester. I haven't had the chance to take too close a look at it as I've been busy setting up my frameworks for other class projects and homework (including Graphics!), but I have been working on plenty of other aspects for our group game. What I do know has been added is:
  • .md5 file compatibility, a file type I'm not familiar with but that appears to make animation crazy easy (sweet!)
  • implementing the new libraries we have to work with this semester
  • incorporating FMOD for our sound class, and our sound .cpp (get it?)
Meanwhile I've been working with the other members of the group to get together some new ideas for obstacles and enemies we can incorporate throughout the semester. I don't yet have a sketch ready yet but my new enemy idea is a hawk that swoops by and drops an egg on the player to do some damage. Before the week is up I plan to have this enemy fully designed and in the beginning stages of modelling, as well as modelling a few simple obstacles that I can UV map and paint next week. Every little model helps, right?