BlitzMax 3D Module Shaders

Miscellaneous Forums/General Discussion/BlitzMax 3D Module Shaders

http://www.blitzbasic.com/logs/userlog.php?user=1&log=507
The new news.


Seems like a moderatly good idea, but what do I know :P


Good luck BRL, and fantastic job! :) Nice to know that it's
going along well.

Cool :)

Neat.

<Note: rambling follows>

My route is a little different, but for all practical purposes is the same concept minus the idea of having brush, light, etc. shaders.

Basically, mine works like this:
1) Create a vertex and fragment/pixel programs written in GLSL (or Cg, I'm looking at swapping out GLSL for Cg, but no decisions have been made as of yet)
2) Write .shader file and specify the shader's vertex and fragment programs
3) Set shader property in the .material file and make sure the material meets the needs of the shader.

I'm also contemplating writing my own shader language, but that seems a bit like overkill to me when I'm not going for an abstracted rendering API. Dunno, we'll see. I could always swap out my existing graphics framework for the Xiphias API I wrote a while back.

Yeah, it sounds like its gathering momentum quite nicely.

ogre has a pretty nice shader system worth looking at, as well as blitz libe blend modes and what have you, just a lot more of them. Don't know if Mark looked at OGRE, It also Has user definable material LOD and techniques. So you can create custom fallbacks for different specs and GPU's.


ogre has a pretty nice shader system worth looking at


I did have a look at this but it just seemed to be another monolithic '.fx' type system.

What in particular did you like about it?

im guessing that it will not be compatible with .fx files unless we translate it into Bmax code?

Looks confusing to me, I guess I dont need shaders yet :p

im guessing that it will not be compatible with .fx files unless we translate it into Bmax code?


As far as I can see, Mark will have to write his own shader language.

I can't see that turning out as a good thing, but the way he went about it is neat at least.


im guessing that it will not be compatible with .fx files unless we translate it into Bmax code?



No it wont. Plain .fx files (when used to encapsulate shaders - not the 'technique' stuff) are too inflexible for my liking, and seem to me to have almost become a 'demo' format!


As far as I can see, Mark will have to write his own shader language.



Not necessairly. It would in fact be easier to 'link' GLSL or HLSL bits together with the aid of a few 'pseudo' ops in the high level code.

In fact, this is probably the way it'll end up long term, and it can be easily integrated into the current system using something like:

ShGLSLCode:TShExpr( source$ )

...ie: a shader expression that contains an entire high level routine.

Looks confusing to me, I guess I dont need shaders yet :p


I've used a few shaders, and even dabbled with writing a couple, and it confused the hell out of me too, so I wouldn't worry. I assume it will make much more sense when it needs to.

I can't say I understand much of this whole thing, but I am confident that Mark makes it userfriendly enough.
BlitzMax is my preferred programming platform, and Max3D will be a welcome addition.

How easy will it be to translate from .fx to .maxshader?


How easy will it be to translate from .fx to .maxshader?


Very hard to impossible. But we should perhaps clarify a bit: .fx is to do with a lot more than just shaders, so we're really talking about .fx files that happen to contain shader code - and even then we're really just talking about the shader code itself. The whole 'what is an .fx file' thing is very confusing!

But Max3D will come with a bunch of cool shaders anyway for stuff like
phong shading, bump mapping, parallax mapping, projective lighting, wind morph effects and more.

And of course they'll be interchangeable, eg: you'll be able to have a bump mapped, wind morphed model lit by a projective light without having to write a line of code.

When I mentioned OGRE materials I didn't mean the shaders so much as how the materals are set up as scripts that contain all the basic material/Brushdata either per mesh or all the materials in a scene and specify which texture layer coinsides with which part of a shader.

Seems to work quite well for both coders and artists, as coders can edit features in a text editor without using art tools, and artists who's exporter doesn't support a particular eg. blendmode, it can be added in a script.

Anything that can make playing with shaders fun and easy is a good thing. Only thing I'd miss would be the ability to use 3dsmax and its easy to use WYSIWYG material editor for .FX .HLSL export.

Hopefully Mark will come up with something that can be made compatible with third party art tools.

Cool Max3D sounds like its commin along nicely. Hey Mark, where in New Zealand do you live... Auckland?


Hey Mark, where in New Zealand do you live... Auckland?


Yep - where are you?

In fact, this is probably the way it'll end up long term, and it can be easily integrated into the current system using something like:


That is, at a basic level, how mine work. The only difference being that mine doesn't have TextureShader/BrushShader/LightShader. It could work, but I think it's better to just write vertex and fragment shaders for specific tasks and combine them for specific purposes.

E.g., combine a lightmapping fragment program and a generic vertex shader that simply transforms the vertices without any animation operations and such.

I have some ideas on how the chunks method could work, will have to try them out later.

Im in Whangarei, Far out, Im only like 1 1/2 Hrs drive from you, freaky!

Taken up stalking then, Leiden? ¬_¬

Yeah Im going to infiltrate his house and secretly steal Max3D!

I expect you to sell me a copy.

He'd sue my ass if I did that :P

He'd sue you if you stole it too -_^


That is, at a basic level, how mine work. The only difference being that mine doesn't have TextureShader/BrushShader/LightShader. It could work, but I think it's better to just write vertex and fragment shaders for specific tasks and combine them for specific purposes.


Vertex/fragment shader is not a very useful 'logical' division - it just happens to be the current 'physical' division.

Sweet! This is the most I've seen Mark communicate in ... like 4 years! I'm just happy about that ;)

Max3D sounds like it's going to be everything we loved about Blitz3D and more.

Yes, I saw 'Howl's moving castle' last week and 'Totoro' last night.

Great movies for the cynical middle age coder!

Yes, I saw 'Howl's moving castle' last week and 'Totoro' last night.

Great movies for the cynical middle age coder!
Howl's Moving Castle was awesome. My five year old daughter and I have watched it at least five times since buying it.

..hey Mark, thanks for progress, by the way, when you expecting to lounch Max3D, just rough time frame if its hard to define exact date..me personally dont have Blitzmax, but i will take it immidiately after 3D module is out, as well as many other guys here i suppose..anyway, any schedule for releasing Max3D??

when you expecting to lounch Max3D, just rough time frame if its hard to define exact date


Oh dear, you've asked it now!

yea..it seems to be bad question..man just dissapear after I asked..

Here's hoping it only recompiles shaders when theyve been changed, and not everytime it see's them called.

Howls moving castle is fantastic... recommend you all see that one as soon as pos.

Hey mark, like the shader styles.. I'm no expert so this modular sort of plug and play shader system is going to be really helpful.

aaaahhhhhhhhhh.... some news... ohh, i can breathe again... :)

thx so much for the info mark... please, if you can, i mean, if the shader elements are not integral to the 3D module architecture, don't let that component be the cause oany further delay...

i'll take the 3D module with just generic pixel shader/vertex shader capabilities that you demoed last year right now...

--Mike

Congratulations on the work you've gotten done Mark, I hope all goes as planned until the end!

> i'll take the 3D module with just generic
> pixel shader/vertex shader capabilities that
> you demoed last year right now...

Mark told me he'd give you the module if you started using only one full stop.

i can do that!!!

--Mike

Congratulations on the fantastic job you've reached so far Mark !

I'm more than sure, that your BMAX3D module will be another mile stone in the programming world.

Thanks for keeping us informed.

Sergio.

P.S.
Will the Blitz3D syntax still be supported by the BMAX3D module ?

Here's hoping it only recompiles shaders when theyve been changed, and not everytime it see's them called.
Judgeing from the "You've written 30 shaders" bit, I'm not sure they're 'compiled' at runtime, at least not dynamicly. I could be reading it wrong tho'.

Could we have also some comments from the BMAX3D beta testers out there ? (if allowed, of course)

Sergio.

"BMAX3D beta testers" ::: Que pasa!?! I want to be a betatester also :)

Sounds great!


i can do that!!!



He just has to place his finger on a different key, (Apparently "!") for his nervous disposition. ;)

Seems to me what he was saying was that yes, the various bits of shaders would be combined together into a single shader, and since it's `code`, in some way that means compiling, or at least `linking together` chunks of code, even if they are pre-compiled chunks.

I think the overall system sounds pretty cool. At the moment it looks a tad technical and needs some nice user/beginner friendly abstract terminology to make it much clearer and easier to understand. I guess maybe what you have so far is just to get the thing working. I don't really want to have to memorize wierd register names or strange parameter names to be able to create these programs.

I think eventually an `as easy as BlitzMax` language could be written on top of what's there, or even using a subset of existing commands.

I guess we gotta have shader hardware, then, to run this stuff. Or can you still do 3D things, texture mapped and lights etc without having shaders?

Also how does this tie in with Max2D? Will 2D stuff be incorporated into 3D so that it's natural and easy to treat all 3D things like 2D (front-facing), with shaders etc? Does Max3D make Max2D obsolete/integrated?

What kind of price are we looking at here?

What about an estimate of how far off this might be from completion? I have a birthday coming up ;-D

Overall sounds very promising. Keep up the good work.

Was just thinking, something that'd be real nice is if you can simply refer to the pixel that exists in the backbuffer, or the pixel in the texture ... then you can decide whether to read from the backbuffer or the texture, and can also decide whether to write output to the backbuffer or the texture. This would give us multiple render targets/render to texture/buffers? I have no idea if this works or whatever, would be nice tho.

These are nice news...


'Create a simple texel lookup 'expression'...
Local texel:TShExpr=ShTex( ShAttrib( "texcoords" ),ShParam( "Texture",SHTEX2D ) )

'...and use it to create a brush shader...
Local shader:TShader=CreateBrushShader( texel )

'set a shader parameter...
shader.SetParam "Texture",LoadTexture( "image.png" )

TShExpr here stands for 'shader expression', and ShTex, ShAttrib and ShParam all return 'TShExpr' objects. Here are some other kinds of shader expressions...

ShAdd:TShExpr( lhs:TShExpr,rhs:TShExpr ) 'add 2 values
ShSub:TShExpr( lhs:TShExpr,rhs:TShExpr ) 'subtract 2 values
ShMul:TShExpr( lhs:TShExpr,rhs:TShExpr ) 'multiply 2 values
ShTex:TShExpr( coords:TShExpr,texture:TShExpr ) 'look up a texel
ShParam:TShExpr( name$,format ) 'shader parameter
ShAttrib:TShExpr( name$,format ) 'shader attribute



Will this be handled internally, abstracted from us or will we have to write programs like this? It seems a tad against the grain of b3d style of doing things.

I think you should write an abstraction layer to glsl/hlsl that is like a basic shader. Then you can do things like,

Coord = Transform3D()
Coord.Rgb = LightCoord( LightX,LightY )

etc.

make it real easy for us to create our own shaders from scratch while still using your plugin bits of shader code that mimic the fixed function pipeline.

Very hard to impossible. But we should perhaps clarify a bit: .fx is to do with a lot more than just shaders, so we're really talking about .fx files that happen to contain shader code - and even then we're really just talking about the shader code itself. The whole 'what is an .fx file' thing is very confusing!


Fair enough. As you say, .fx is pretty much a container file, and can contain all sorts of different things, like instructions telling the "engine" how to use the shader and can vary quite dramatically.

So put another way. Is it going to be possible to use either RenderMonkey or FXComposer for BMax shader development?

Good question, Gabriel.

I was wondering if the .fx files I can output with 3DMax could be used to describe materials in BlitzMax3D.

Would be nice to have support for 3dsmax shader output, since it does a really nice job of WYSIWYG shader creation with the max material editor. That exports a .FX file that describes what texture does what and a .HLSL that contains the shader.

Can see a video here http://download.autodesk.com/media/3dsmax/directx_max8_350k.wmv

Makes masked bumped specular environment reflection mapped objects using the same materials and editor you would for pre rendered stuff.

Stop whining everyone. I'm sure most effects will be shared by programmers here, and much progress will be made. Max's built in shader output is unbelievably generic.

who's whining, just asking qustions and offering suggestions. I think there are valid concerns when people want to use 3rd party tools to develop game resources. Otherwise we may be waiting 2 years after release for useable art pipelines to arrive that make proper use of the renderer.

Mark knows how important the art path is.

I think shaders are definately able to be artistically put together, however I think ultimately there's only so many 'useful' shaders you want.

For example physics, you want a shader to manage the bridge between your physics sdk and the actual gpu because this way, it's so many times faster. Shaders go beyond the artistic.

Stop whining everyone.

I'm familiar with your theory that everyone who has an opinion which is even 1% different to your own is either :

a) Flaming
b) Whining
c) Insane.
d) All of the above.

But please try not to spoil a thread which has been informative and respectful.

I don't see anyone whining. Then again, I'm not really paying attention to anyone's posts other than Mark's due to the fact that he's the only one that can provide useful information on the subject.

Do shut up gabriel, just because I intimidate you it doesn't mean everyone else feels the same.

I don't think it's intimidation, I think it's annoyance. Your behavior is like mine, Rob, except that you complain about people rather than code.

Nice update for us Mark. Thanks :)

I don't really want to have to memorize wierd register names or strange parameter names to be able to create these programs.
Who are you, and what have you done with Paul West! :o>

Do shut up gabriel, just because I intimidate you it doesn't mean everyone else feels the same.


Ahh, so you *do* have a sense of humour.

lol Mikkel. Progress I guess.