Procedural Texturing

Uh oh, there’s that word. “Procedural”.

For those who didn’t follow the game fanatically in the months up to it’s release, procedural was one of the words used by Will Wright to describe Spore in the early prototypes. As a result of that innocent usage, it developed something of a buzzword hype around it and grew a semi-independant life of it’s own. Unfortunately, once Spore was released and the inevitable backlash began, Procedural fell out with it’s partner, turned to drugs and alcohol and ultimately ended up joining a cult and sacrificing the local high-school kids to Satan. True story.

Once you strip away all the correlations, though, all it means is ‘automatic’. It’s just a way of saying we wrote a procedure in code to do something, rather than doing it manually. In this case, applying texture coordinates.

Same creature, same texture, but the bottom image is procedurally textured by the Species engine: I didn't have to do a thing in 3ds max.

Same creature, same texture, but the bottom image is procedurally textured by the Species engine.

Texturing is something you’d normally do in 3ds max (or any other 3d editing software), because it gives you a variety of useful tools to do so. It’s possible to use the tools in max to customise and tailure exactly how textures are applied to your models, which is how other games can apply a 2d image to something as complex as a character model, for example. That’s how we were applying textures to body parts in 0.4.0 and 0.5.0.

Unfortunately, after accepting the models we feed into the game from 3ds max, Species proceeds to stretch and scale them according to the creatures genes. This in turn stretches and scales the textures, resulting in some rather strange visual artefacts. (Note: though it’s not an official term, a certain subset of programmers use “artefact” to refer specifically to visual errors in games, and “artifact” for all the other definitions. It’s totally not a typo I swear).

Aside from the obvious size difference, procedural texturing also eliminates the texture stretching around the shoulders and on the arms and feet. :)

Aside from the obvious size difference, procedural texturing also eliminates the texture stretching around the shoulders and on the arms and feet. 🙂

I had originally planned to do this in 0.7.0, but the website being down for so long meant I ran out of smaller tweaks and fixes* to implement, so it looks like we’re gonna get procedural texturing as a bonus feature in 0.6.0.

The method I’m using is called tri-planar texturing. The idea is to apply the texture from three planes, picking which one depending on the orientation of the surface. It’s a system more commonly used for terrain texturing, and I’ve had to adapt it a bit to apply it to an animated model (we don’t want it to be affected by stretching, but we do want it to be affected by rotation and translation), but it works well. I’ve often wished 3ds max had a triplanar shader in it…

Of course, there’s always a downside. Tri-planar texturing requires a consistant, tiled texture, which means we need to remake all the older textures, which weren’t tiled. Anything that involves remaking an entire category of files is a lot of work. It’s been easier than expected though: setting up a photoshop macro’s and using the automatic healing brush (WHAT SORCERY IS THIS?!) made tiling the images almost rediculously easy.

This is still just a stepping stone for 0.7.0 though: ultimately, I plan to make all the current placeholder body covers redundant and start over. This will be a good step not just for appearance, but also for functionality: I’m sure you’ve all noticed that skin type can change drastically in a single mutation. This is because it has no sensible mutation map: any body cover can mutate in a single step to any other body cover. In fact, the current body-covering system is one of the most placeholdery things in a game filled with placeholders (we don’t even note body cover in the creature details!), and implementing a proper mutation map and a variety of extra body covering types should vastly improve that side of things.

I plan to go quite a bit further with the texturing than just tri-planing their skin: this is just a first step. I’d tell you about the other plans, but well… “spoilers”. 😀

*footnote: Speaking of fixes, you know that crash that sometimes happens when you’re importing and exporting creatures? I found it. It only happens on export when you’re in “Ecosystem mode”, so until 0.6.0 comes out just make sure you do all your exporting from Creature Mode (when you’re in creature mode the UI looks blueish, rather than green (ecosystem) or red (species)).

Release Date: Assuming we get the website back this week, Species 0.6.0 will be released to everyone on the 17th June.

Wait, should I have made that have been more dramatic? Dammit.

Advertisements
  1. #1 by Pierce Elliot on June 4, 2013 - 12:02 am

    Ah, I remember 3dsMax. Remembered that within 5 minutes of picking it up I somehow was an animating prodigy.

    But that’s just me bragging.

    Glad to see procedurally generated textures in game. Also can’t wait for a more dynamic transition between creatures skin. I was personally thinking you could use a mapping technique to form the texture and merely color the skin. But also do this in a way that is a slow transition.

  2. #2 by TheAlfaTurkey on June 4, 2013 - 2:35 am

    I’ve been waiting for this update for a while.. You’re doing a great job at updating this so quickly!

  3. #3 by White parrot on June 4, 2013 - 8:22 am

    Each time you speak about procedural content, it reminds me not of Spore, but of Evolution (“the game of inteligent life”) : at the end of the manual, there’s a massive rant from the developper, and at one point he laments that what we would call today procedural content is not available to add in evolutionary games, meaning that it’s not possible to simply watch the first creature evolves into an unplanned form by itself …
    … And now, some fifteen years later, this is precisely what Species allows us to do ! Put things into perspective, I think.

    Fantastic work !

  4. #4 by WellOiledProf on June 6, 2013 - 6:42 am

    Wait; didn’t you already make a mutation map for skin types?
    I recall some kind of chart mentioning things like protofeathers and such.

    Really excited to see that you’re trying to raise the game aesthetics on the creature level
    Colour wise the creatures tend to look a bit too garish; though the issue there is probably more to do with there being no evolutionary impetus to blend in with the surroundings because predator intelligence matches that of the surrounding shrubbery lol

  5. #5 by WellOiledProf on June 6, 2013 - 6:44 am

    Don’t want to nag but…

    Where can we find a list of the features in 0.6.0?

  6. #6 by Pierce Elliot on June 6, 2013 - 6:58 am

    I don’t believe there is one available (Of course, I could be wrong. I’m not in charge here). But if you look through previous blog entries you can probably get a general idea.

    Once the main website is back up, I’m sure that there will be something similar.

  7. #7 by ququasar on June 6, 2013 - 7:47 am

    The original “planned features” summary on this blog contains most of the major features.

    https://speciesdevblog.wordpress.com/2013/03/06/where-to-next-0-6-0/

    We’d usually have a more up-to-date changelist on the site forums. Hopefully that’ll be back soon.

  8. #8 by ququasar on June 6, 2013 - 12:58 pm

    Oh yeah, this chart: http://wearesmrt.com/bb/download/file.php?id=216

    It was actually one of the earliest pieces of documentation for Species, back when the whole thing was just an idea. That documentation didn’t translate well to implementation, though (for one thing, it’s really hard to find redistributable protofeather textures on the internet). I ended up putting it aside and tying a bunch of random downloaded placeholders together just to get something working.

    I’ve since done a much more complex version of the body covering chart, which is going to be even harder to find (or make) textures for.

    The colourful creatures issue is actually a statistical result of random mutation (or just randomisation, in the case of the randomly generated creatures). In order to get a monochrome colour when I randomise the three colour axes (RGB), I need to get the same number all three times. This means I’m much more likely to get something colourful than grey. White and black are even more unlikely.

    The cumulative result of this, even if you start with the grey Primum Specium, is genetic drift towards brighter colours. Genetic drift is actually a powerful (albeit often underappreciated) mechanism of evolution. In Species, at the default 1.0 mutation rate, it seems to outweigh natural selection in a lot of cases.

    So with all that said, it would be go against my design philosophy to ‘fix’ the colourful creatures issue. It’s a valid result of the simulation. On the other hand, you have a point it does look kinda ugly.

    Hmm… I am having the thoughts…

    The RGB representation is unnatural in and of itself. In nature, pigmentation is handled by chemical compounds of certain colours that are pushed to the skin. A chemically-accurate pigmentation simulation is beyond even my level of bio-masochism, but the point is that there is more than one way to represent colours: we’re not necessarily locked into using RGB. It’s only real advantage is a slight performance gain, anyway.

    One possible solution would be to store them as Hue-Saturation-Luminosity. This would mean the genetic drift would seem less directed: similar numbers in HSB would still be less likely, but they don’t have any sort of correlation to a specific tone or shade. If anything, HSB would supress bright colours: only half of creatures would have a high Saturation value, and many of these would have high or low Luminosity, making them either pale or dark.

    Actually, the more I think about it, the more I like the idea. It’d give the game a less garish and cartoony look without me ‘imposing’ that as a mutation bias. Plus it’d make the game look less like Spore. I wanna try my hand at this. Like, straight away, for 0.6.0. I’ll report back tomorrow, after I’ve had a chance to experiment…

  9. #9 by Dan on June 6, 2013 - 9:28 pm

    Hello,

    I’m a biology student from Italy. I’m writing here to say a huge THANKS YOU for developing this. I’m going to follow the development closely and spread this to my university mates/professors.

    This simulator is by all means my dream come true, software-wise speaking, and i really would like to contribute in any way and help you in the development, directly or indirectly. The way you’ve implemented natural selection or random mutation is astonishingly true to real-life evolution, but in the same time the simulator is extremely pleasing graphically and believable. Also, the fact the fitness value is not preset, like in the majority of the evolution sims out there, makes it even better.

    Please, please, be safe, do not expose yourself, your life is now too valuable, you need to finish this project!

  10. #10 by Dan on June 6, 2013 - 9:31 pm

    ALso, is there a way to contact you in a more direct fashion? Facebook, MSN, Skype or whatever?

  11. #11 by Neovenator on June 7, 2013 - 7:07 am

    Normally you’d be able to just use the forums. They’re down at the moment.

    Also DANG IT SPEC-EVO FORUMS, Y U NO NOTICE!?

  12. #12 by Neovenator on June 8, 2013 - 6:06 pm

    Never mind, they were just too busy playing. Carry on.

  13. #13 by Neovenator on June 15, 2013 - 4:12 am

    OOOH SO SOON. I AM GOING TO GO FIND MONDAY AND CATCH IT IN A NET, AND THEN SHARE IT WITH EVERYONE SO WE ALL GET SPECIES 0.0.7

  14. #14 by Neovenator on June 17, 2013 - 5:22 am

    THE WEBSITE… IT LIVES! IT LIIIIIVES!

  1. Colourful Creatures and Genetic Drift | Species Development Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: