Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Graphics Programming

Developer of 'Banished' Develops His Own Shading Language 31

jones_supa writes Luke Hodorowicz, the hard-working developer behind the townbuilding strategy computer game Banished, has
designed a novel GPU shading language and written a compiler for it. The language has been christened 'Shining Rock Shading Language' (SRSL) and it outputs the program in several other shading languages. The first goal for the language was to treat the vertex, fragment and geometry shader as a single program. The language sees the graphics pipeline as a stream of data, followed by some code, which outputs a stream of data, and then more code runs, and another stream of data is output. Body text of the shaders is very C-like and should be understood easily coming from other shading languages. SRSL has all the intrinsic functions you would expect from HLSL or GLSL. All types are HLSL-style. Loops and conditionals are available, but switch statements and global variables are seen redundant and not implemented. Luke's blog post tells more about the details of the language, complemented with examples.
This discussion has been archived. No new comments can be posted.

Developer of 'Banished' Develops His Own Shading Language

Comments Filter:
  • by Anonymous Coward

    Shader languages are just like CSS and JS. They're all quite crappy, but can't really be fixed by the community, so lots of people end up writing "transpilers" to try to work around some of these many problems. That's why we have Sass and LESS and CoffeeScript and TypeScript and now this new shader language. Maybe they fix some problems, but their presence introduces a different set of problems. The right thing to do would be to push for the underlying technologies to be fixed.

    • by Anonymous Coward

      It isn't even remotely like that.

      CSS and JS have very little issues with incompatibility, besides input related stuff, and oddly enough, CSS access from JS. (holy shit that whole set of commands is awful, fix that shit already, it has been a decade for crying out loud)
      SASS, LESS, CoffeeScript and TypeScript (less so this) are mainly created to make it easier to work with CSS and JS.
      Some have support to export to other languages. But mainly they are designed to enhance and speed up development considerably

  • The good news is that with new standardized intermediate representations like SPIR-V in Vulkan, this shading language can compile down to the same IR that GLSL/HLSL/etc. use so there's more flexibility on the programming language side while maintaining compatibility with the graphics API.

    • by Arkh89 ( 2870391 )

      The nightmare is that you might have to do the compiler job and generate an optimized SPIR-V IR from your language.

  • The biggest problem when going from a platform to the next is not so much having to rewrite the language (pretty much everything runs GLES2 and will run GLES3, and that means GLSL, -except consoles-), but the fact that you will use completely different techniques depending on the underlying hardware and features. Having a single shader language does not prevent you from having to rewrite stuff many times.
  • I have to ask... why? Looking at the few samples, it looks like some kind of hybrid between Microsoft's Effect framework (which used "techniques" to sandwich multiple shaders at different levels together) and Nvidia's Cg language (which output HLSL and GLSL from a common, sorta kinda average of the two languages). Considering how close GLSL and HLSL are already, I just don't see the point of writing anything more than a thin wrapper and a few headers that work as a shim/compatibility layer.
    • by Anonymous Coward

      Keep reading the guy's blog for the why... he started from nothing and wrote the game engine, the game logic, and designed all the graphics and sound himself. I think he did it because he wanted to.

    • Re: (Score:3, Insightful)

      by Anonymous Coward

      Why not? (and, some of his reasons are described in his blog entry.)

      I think this is newsworthy because this developer single-handedly wrote it, after (nearly) single-handedly writing an entire game. This level of motivation and productivity is something special. I'd rather celebrate it (or at least give it a tip o' the hat), instead of deriding it.

      • So would people be interested in my feature rich game engine that I've spend the last 10 years single handily developing on my own with not external help? I need to figure out how to get some publicity on that... but being a programmer, I suck at all these marketing things...
  • This is getting silly!.

  • Wolfenstein (Score:4, Informative)

    by jones_supa ( 887896 ) on Tuesday March 31, 2015 @01:55PM (#49380033)
    I once scooted through the source code of Return to Castle Wolfenstein, and it also seemed to have some kind of intermediate "mini-language" for shaders. It wasn't a language really, but it allowed artists to execute various effects with different parameters (like "winterfog 22 3.0 3.0 1"), which were then converted to real shaders on the fly. What is also surprising that I would have expected such an old game using fixed functionality instead of shaders.
  • by Dave Emami ( 237460 ) on Tuesday March 31, 2015 @02:33PM (#49380287) Homepage
    I'll write my own shading language! With blackjack! And hookers!
  • Now, if only he could fix the bugs in Banished, that would be even nicer feature than creating a one man shader language...
  • global variables are seen redundant

    As is the word "as," apparently.

  • why my towns start starving? i keep building farms, gathering and hunting lodges yet starvation. fix that first!

E = MC ** 2 +- 3db

Working...