DX9 shaders and workspace

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

DX9 shaders and workspace // Archive: Tech Forum

1  |  

Post by rjeff // Dec 5, 2007, 5:13am

rjeff
Total Posts: 1260
pic
Ok..want to learn this real time stuff. Wizzard you can for sure answer this, if you see it... 1st can I build my model in model side and then use is in workspace or does it all have to be done in workspace? 2nd to get thoes sharp realtime textures do you have to use dx9 or can you just use any old .png or .bmp?

Post by Nez // Dec 5, 2007, 5:28am

Nez
Total Posts: 1102
pic
As far as I know you can go backwards and forwards between model side and workspace pretty much as you please when modelling, although you presumably have to deal with infamous bridge to do so. Mind you, not having TS7.x this is hearsay...

No idea on the textures/shaders... plenty of folks should be able to help with that...

Post by Steinie // Dec 5, 2007, 5:48am

Steinie
Total Posts: 3667
pic
I texture using .png and .bmp all the time for realtime. Not sure if you consider my work "sharp" looking.


http://www.renderosity.com/mod/gallery/browse.php?username=Steinie


Renderings 3,4,6 and 8 are realtime.

Post by jamesmc // Dec 5, 2007, 6:14am

jamesmc
Total Posts: 2566
Shaders can be a confusing term. This is best explained by someone who knows what they are talking about, like Tom or someone else from Caligari. :D

Basically, the way I understand it and I may be all wet on this is that textures are a map of sorts that correspond to the U and V of a geometry matrix (your 3D object). And, they only affect the NORMALS of polygons (the polygons facing the camera view.)

Shaders are more complex and there are different types (don't ask me to explain) that can change geometry (displacement of geometry.)

Shaders tend to shade an object completely. Example, take a shader and drag it on an object. If you slice through it with a boolean, the shader on the inside of the object is the same as on the outside of the object even if the item isn't UV mapped.

Procedural Shaders can be made in tS7.51 and are complex derivatives of the DX9 language (I think) and will get more complex when DX10 comes out.

I think of procedural shaders as a shader that can be multi-leveled and has built in attributes such as reflectance, refraction, diffusion, transparency and etc. Like a glass, mirror or metal shaders. Also procedural shaders can be animated.

A texture map doesn't have any of these attributes built in and one must use the Material Editor in trueSpace to change those attributes - although standard texture maps have a limitation on what actually can be changed.

That's about it for my understanding of shaders and texture with most of it probably being wrong. :D

Hopefully Tom or someone with more training in the area can stop by and make a better statement on the differences.

Post by rjeff // Dec 5, 2007, 6:21am

rjeff
Total Posts: 1260
pic
Thanks guys...Stenie...the one thing I don't get and I guess I need to understand. Now as I see it realtime means just that..no render. Or do you still have to render it like in modelside. to make it look as nice as yours or Wizzards..hand image.

Post by jamesmc // Dec 5, 2007, 6:24am

jamesmc
Total Posts: 2566
If you have V-Ray, which I don't I would use V-Ray (Workspace Side) to render and compare it to a Lightworks render.


Eye of the beholder trumps technology any day. :D

Post by rjeff // Dec 5, 2007, 6:42am

rjeff
Total Posts: 1260
pic
yes I know you have to have vray to render...but do you have to render in real time to make it look like Wizzards image. Wonder if Dribble does workspace render?

Post by TomG // Dec 5, 2007, 6:44am

TomG
Total Posts: 3397
Hmm this is a big topic.


The real-time display is what you see when you are modeling. All solid realtime displays are in fact being rendered, by your graphics card rather than by an offline engine light Lightworks. This is true in games too of course. Anything that has a real-time 3D display is rendering :)


Graphics cards have a special way of defining objects (geometry, lights, textures). This is so that anything can pass information to any graphics card - ie any game will work on any card from any manufacturer. If ATI used a different language from NVIDIA, then games would need to write TWO render routines, and that would be bad.


So instead there is a special way of defining things created, and it is called DirectX. This is a way that a game can pass information to a graphics card, and bingo, something appears on screen.


DirectX undergoes upgrades now and then, the latest is DirectX10 (or DX10), but the standard for now is DirectX9 (DX9). All versions of DirectX allow a program to define geometry, lighting, surfacing, textures, etc, and then the graphics card will produce the required result.


Your view in tS6.6 when in sold mode is a real-time render. It is also in DirectX (DX8 I believe). The workspace has an all new real-time renderer, using DX9 so it is much better (DX upgrades bring new possibilties with them). This is why tS requires a graphics card to be DX9 compatible in order to get the best from it, as with a card that only displays DX8 (ie something 3 years old or more), you won't get some of the new effects only possible in DX9.


So that is real-time rendering. tS7 has the advantage that you can grab the realtime render from the graphics card and save it to a file. In tS6 and earlier, you would need to manually use print screen to grab teh screen, paste it into an image app, then save it. The best thing with tS7 is that it can use the real-time engine to grab animations (you couldnt do that using print screen!). This is what is meant about real-time rendering being better in tS7, as you can use it now to easily produce final results (worthwhile now that the DX9 real-time engine is so poweful).



Now, shaders. A shader is a bit of code that tells how to render a pixel on screen, by containing the calculations that will work out what color the surface is at that point on screen being rendered. Shaders come in many forms - reflectance shaders work out how the surface responds to the lights falling on it (is it shiny, matte, bright, dark, see through, does it reflect the scene around it?). Color shaders define the base color (without lighting). These can be texture based, so that an image is in effect wrapped over the surface of the object and defines the color. Or it can be procedural, so that a piece of math works out a formula for that point on the surface to decide its color.


You dont need anything "magic" to show a texture in DX9 - just paint a texture map onto your object, and the real-time display will show it. No need to write a DX9 shader, or do any DX9 settings, just drop the shader on there and tS processes it in Lightworks, or DX9, or V-Ray, as required.


Procedural shaders are different, as are reflectance shaders. They are dependent on what engine is going to render them, so what works one way in Lightworks wont work the same in DX9. DX9 for instanace doesnt support reflecion or transmission (those require raytracing which is too slow for real-time). Things like Subsurface Scattering are also offline only.


You can though write shaders in DX9 that simulate such things, and that is where you get into writing DX9 shaders - but you dont need to do that to get into the real-time renderer in tS! You can just use existing shaders and adjust the parameters and avoid any writing of code or making of shaders :)



As for "using the DX9 engine", just click on workspace and you are using it, and rendering with it - what you see on screen is your DX9 render. If you make it in Modeler, it will display in workspace (so long as the Bridge is active). You can swap between the two views (and you are changing from the old DX8 real-time rendering engine in Modeler to the DX9 rendering engine in workspace as you do so). If you are using simple shaders (which I recommend), you'll find nothing complex about doing that, and you'll find your textures displayed well in the workspace.


You can get into using DX9 only textures, these change and respond in real-time, and need to be applied in workspace only - they also wont render in the offline engines like Lightworks or V-Ray, only in real-time. Just drag and drop on to the object - there are things like cartoon shading, gooch, and so on. Since these are procedural and use routines on the graphics cards and in the DX9 engine, they dont match or convert to the offline engines.


As I say, complex, very big subject. I recommend just simple textures, build objects in workspace or modeler, and look at them in workspace to take advantage of real-time shadows and transparency like you cant get in the modeler real-time. Then work up to trying other shaders and see the differences, slowly and surely.


HTH!

Tom

Post by TomG // Dec 5, 2007, 6:46am

TomG
Total Posts: 3397
PS - Wizzard's images are offline renders, using V-Ray or Lightworks. As noted below, real-time means using EXACTLY what you see on the screen as you model. In tS6.6 this was not good enough for final images, in tS7.5 it can be.


To see how good real-time can be, Marcel Barthel is the one to watch :)


HTH!

Tom

Post by Steinie // Dec 5, 2007, 7:17am

Steinie
Total Posts: 3667
pic
Rjeff, the question Tom avoided, Dribble is for the Modeler side. It will move to workSpace in the future. Tom answered the rest better then any of us could.
Marcel Barthel (Parva) is the man to watch for Realtime rendering. He is the Master. Funny how I am one of the few who use it for Gallery entries and not mentioned...hmmmm
What you see on the screen is what you get. Not always a good thing.

Post by TomG // Dec 5, 2007, 7:34am

TomG
Total Posts: 3397
Hmm I think you must have me fooled then Steinie, as to what is real-time and what is not! Case proven on just how good it can be, I really did not realise you were using real-time and not offline!


I singled out Marcel due to his work mainly with getting a GI type look, something which people strive for offline, and he has been achieving it using the online engine. I've also had the fortune to have all his major scenes sent along for me to actually navigate through in real-time, and I can tell you that is an awesome experience :)


So, didnt mean to "diss" you there Steinie! I think it proves an interesting point though that I had no idea which work of yours was real-time and which offline - real-time rendering truly has come of age in the hands of artists like yourself. Which reminds me, we need to make you Gold Ambassador for your External Gallery win, a glance through and I dont think I have your write up on the Ambassadors page!


Didnt mean to avoid the Dribble question, I just didnt know the answer (have not had time to look at Dribble in any way other than short glances at it here on the forum) - been kinda busy with just Caligari stuff lately :)


Thanks!

Tom

Post by butterpaw // Dec 5, 2007, 8:19am

butterpaw
Total Posts: 831
pic
Wow, I have learned so much in the short time it took me to read through this thread!

Thanks so much to rjeff for asking, and the rest of you for answering!


@Steinie - I didn't know either.. that makes your images all the more amazing to me! ^_^

Post by rjeff // Dec 5, 2007, 8:21am

rjeff
Total Posts: 1260
pic
Thanks Tom and Stenie. The only reason I was curious about that is I took my vidoe card in to workspace to see what it would look like and well the textuers were blurry and well some of the were not what I had applied in Model. So Parva's church is real time and not render..ie like in model side..if so..then wow..indeed. When I think real time I think like Gears of War. They seem to have reflections in the game.

Post by parva // Dec 5, 2007, 8:35am

parva
Total Posts: 822
pic
Are your textures blurry if you look close to your texture or if you are further away?
Because most distance texture blurring comes from the mipmap filtering.

DDS file format has the advantage to store presaved mipmaps plus filtering and other settings. Unfortunatly truespace7 doesn't take care of these.

They seem to have reflections in the game.
Most reflections are done via environment cube mapping. Either as premade texture or with render to texture. Premade textures are rigid but ressource friendly. Render to Texture (think on water) needs more ressources.
Maybe a future feature of truespace.

Post by TomG // Dec 5, 2007, 9:38am

TomG
Total Posts: 3397
Fuzzy textures - in the modeler, open up the realtime render properties dialog. In there you set the resolution to use in your textures in the real-time engines in both modeler and workspace side (and in V-Ray too for that matter).


tS will "downsample" textures by default, to make them smaller and so less greedy on graphics card memory. If your card has enough memory though, it can probably handle higher quality textures, so you can raise the resolution to use. I think the default is something like 128, and on a reasonable modern card you can raise that to 512, or even 1024. This can cause performance slowdown on less modern cards though.


The result is that your texture will be sharper with these higher values - I suspect this is why your textures look blurry.




Yes, you can "fake" reflections, transmission, subsurface scattering and many other things in real-time. Reflections in game are all faked in some way, either using environment mapping of one sort or another, sometimes a more weird approach is to actually have a mirror version of the scene being rendered (ie everything is upside down) and it is made visible in the water. tS can actually "fake" reflections too, by having a camera in the scene that outputs what it sees as an image - that image can then be placed as a texture on another object, and you have instant television monitor, or mirror, etc.


Actually calculating a reflection would be very slow, so these 'tricks' are used to keep speed up in real-time. Many of these tricks get adopted in hardware, making them even faster.

Post by rjeff // Dec 5, 2007, 9:47am

rjeff
Total Posts: 1260
pic
why thanks guys..I have learned alot today.

Post by rjeff // Dec 5, 2007, 10:00am

rjeff
Total Posts: 1260
pic
One more question and I will let you go...for now..!! In Gears of War they have blooms on the armor of the guys and other objects here and there. When looking at the bloom the have as opposed to the bloom in TS theirs do not overwhelm the scene. It seems to me that their bloom is more object based instead of well scene based. That is the best way I can describe it. I hope either Tom or Parva has played GOW.

Post by TomG // Dec 5, 2007, 11:14am

TomG
Total Posts: 3397
Yep, got it as soon as it came out, was a favorite of mine for a while :)


Bloom settings should enable you to avoid it overwhelming the scene in tS too. Setting threshold is important, so that only bright areas glow. Also avoiding too high a glow and sticking with bloom can help. You can basically get it so only very bright points show the effect, leaving the rest of the scene pretty much unaffected.


The effect is a realtime post process (ie the image is rendered and stored in a buffer, then another calculation pass is done over the rendered image to add in the bloom / glow). AFAIK this is how it is done in GoW too, so I dont think some objects would be included and some not (though it would not be impossible to do so). tS I do know applies it to the whole image, but again with careful settings it should give a similar (if not identical) effect. Be sure to have shiny objects where you want them to have glows and blooms in their highlights :)


Note that I think GoW also does real-time HDRI stuff, the old "eyes adjusting to the different brightnesses" thing (crops up all over the place now, first showed up in Half Life 2, now GoW, Halo 3 etc all do it) that we dont do in tS real-time, that too might be part of what you are seeing.


Glad this has been an educational thread! :) And there is a LOT we havent covered, really is a huge topic!


HTH!

Tom

Post by butterpaw // Dec 5, 2007, 12:02pm

butterpaw
Total Posts: 831
pic
Any time you care to expound further.. I'll be here reading too! ^_^

Many thanks for sharing what you know! :)

Post by rjeff // Dec 5, 2007, 4:02pm

rjeff
Total Posts: 1260
pic
Hey Tom you on Xbox live? If so PM me and I will give you my screen name. We always need some more GOW players or well Halo3 and all the other games...have you playd COD4? Fantastic game.

Post by Nez // Dec 5, 2007, 11:08pm

Nez
Total Posts: 1102
pic
PS - Wizzard's images are offline renders, using V-Ray or Lightworks. As noted below, real-time means using EXACTLY what you see on the screen as you model. In tS6.6 this was not good enough for final images, in tS7.5 it can be.



HTH!

Tom



I'd note that, whilst giving a lot of other great info on this thread, Tom's not quite correct here (no offence Tom!) - W!zard's images are USUALLY Lightwork's renders but he has recently being playing with real-time renders too and one of his latest bunch, submitted to the Gallery (and an Honourable Mention at that) was a realtime render. See here: http://forums1.caligari.com/truespace/showthread.php?t=4530

Post by parva // Dec 6, 2007, 1:38am

parva
Total Posts: 822
pic
It seems to me that their bloom is more object based instead of well scene based.

I don't know Gears of War but I have seen some screenshots (first I thought it's a kind of unreal tournament, looks similar).

Not sure if right but another possibility is that they don't use "bloom" but glow.


Like Tom said, bloom is enhanced in newer engines with hdri lighting in combination with eye adaption (mostly reinhard tonemapping).


Glow is an advanced material shader only applied to specific areas via texture so that only these areas glow. Not possible in truespace yet.

Post by TomG // Dec 6, 2007, 5:52am

TomG
Total Posts: 3397
Woah, fooled again. Though I am of course happy to be fooled this time. Lately I can only scan non-"help me" type threads rather than read them properly, so saw the three images but never read about them, and would never have guessed that was real-time.


That's the sort of thing where it is cool to be wrong :)


Thanks!

Tom

Post by W!ZARD // Dec 26, 2007, 6:36pm

W!ZARD
Total Posts: 2603
pic
Oops! I completely missed this thread - sorry Rjeff.


As Tom has said this is a huge subject but you might be interested to know some of the strategies I've found for getting real-time results like the image Nez referred to (thanks for sticking up for me Nez! ;)).


Firstly let me say that the objects in this scene come from different sources with most of the models being built in either tS 5.1 (the central temple structure) tS 6.6 or tS 7.5 Model side - the terrains were made in MojoWorld but could easily have been made with tS 7.


Next, a word about the 'background' - this is a spherical image painted on a ... well a sphere! It started as six square images rendered using MojoWorld 3 Pro which I converted to a spherical projection image using a free app called Projection by Urban Velkavth. I had to do a lot of experimenting to get the highest possible resolution for the final sky image.


The terrains, height fields made in Mojo and textured using a variation of the DX9 terrain material - again this uses quite big textures for sharpness.


Every texture used is a DX9 material using images for the diffuse colour and normal maps (mostly generated using a plug-in to The GIMP - damn I LOVE that program! :D). I did this because it feels like the workspace real-time renders operate more smoothly using this type of DX9 shaders (as opposed to DX9 shaders derived from LW materials) - although this could be my imagination at work! The other reason is that these shaders have more editing options in the Link Editor.


So once I've got all my models placed and textured I use First Person mode to walk all around the scene to check that it all works as an immersive environment.


Much time was spent getting the lights working to my satisfaction - but that's a whole other huge topic by itself!


So finally the time comes for a final image for the Calligallery. First I selected a pleasing viewpoint, imported a few extra props like my trusty flock of seagulls and a Wizard figure from my library. Then into the settings panel where I set AntiAliasing to maximum setting (3) activate bloom and super sampling (and watch my graphics card start to steam when trying to navigate the scene!!).


When that's all done I used Render To File button, set the output image to produce a large picture (1920x1200 in this case) and saved the result which took maybe 9 or 10 seconds to compute on my machine.


Last steps are to resize the picture, convert it to .jpg and post it off to the gallery.


Here's the end result.


(I've since done a lot more work on this scene - it's currently sitting at 45.12 MB - and will be posting more pictures from it soon.)


Hope this helps....:D
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn