Re: How to blend 2 textures based on vertex alpha values in realtime viewports

Date : Tue, 08 May 2007 17:17:56 +0200
To : XSI(at)Softimage.COM
From : André Adam <a_adam(at)49games.de>
Subject : Re: How to blend 2 textures based on vertex alpha values in realtime viewports
I doubt middleware is much of an issue, game companies usually require a lot of manpower and huge pipeline systems, simliar to film productions, with the additional issue on top that those pipelines are designed to work for a lot of years. Making inroads here is difficult. Softimage traditionally has a very good standing in Japan's games market, and gaining ground in Canada and the US as far as I can tell. However, Max is the way bigger player overall in this market segment, while it seems Maya has been focussed on the film market instead.

My 0.02

   -André


Fred Jacob wrote:
Not that good I think. One of the problems is that the number of games middleware companies supporting it is very little. I know of only two that can be taken serious, and thats Valve (Half Life)
and Granny (although thats rather a game animation system with additional 3D engine building blocks rather than a fully fledged game engine).
There might be open source projects I'm not arware of, and then there is the Nintendo, which supports a 3D assets exporter for the NintendoDS.


For the big players in the games market this is not such a big issue as they could afford to write their own exporters for their own engines, but they are also slow to adopt new packages as they have built their expensive pipelines around some older 3D package like Maya or Max and are therefore not as agile (reraining lots of people costs lots of money as well).

I work for a company of 30 people and have to whitness myself how hard it is to convince others to look at software they are not used too or have to write custom software for (e.g. exporters) to make use of it. Especially artists are usually very protective about "their" package and are not willing to learn something new.

Fred





-------- Original-Nachricht -------- Datum: Tue, 08 May 2007 09:05:17 -0400 Von: Christian Rittener <christian_list(at)b-cosmos.com> An: XSI(at)Softimage.COM Betreff: Re: How to blend 2 textures based on vertex alpha values in realtime viewports

So what's the share of XSI in the game market these days?

Christian Rittener

Andy Jones wrote:
Yeah, I've had that same problem. I apologize for not thinking to mention it -- I thought they'd sorted it out. Anyway, the fastest way to get up and running if you don't want to deal with it "neatly" is to just grab all the cg binaries and dump them into the XSI binaries folder. That should work. I think it's a dependency on one of the dll's you'll find in some path such as "C:\Program Files\NVIDIA Corporation\Cg\bin." And yeah, I hit that toolkit beta thing too. They
compiled against a beta. It seems like a weird choice, but I guess this
stuff is really more about the game market and they're developing for the betas anyway.


There was a time (XSI 4) when this stuff just sort of worked, and the only tricky thing was that you had to install the cg toolkit. Nowadays,
it seems to be a little trickier. I haven't looked into it lately, so I
can't even really tell you what the status is. Just that I've usually been able to fix the problem by doing what I described. I'm certain there's a nicer way, though.


If that still doesn't work, I guess check to make sure you have the actual cg_shaders.dll in the Softimage bin directory. But that should be installed by default.

Let me know how it goes. Also, if your cg programmer is good, maybe see
if he can figure out how to get the silights array or any of the SAS stuff to work. I haven't been able to. So far, the only way I was able
to get a light array was to write my own custom version of the cg_program plugin. But maybe I've just been doing something wrong. I think maybe it's only implemented for the .FX plugin, but I couldn't tell from the docs, and I haven't played with the .FX plugin yet.


- Andy

Fred Jacob wrote:

Right, I got hold of a shader programmer to do it for me. I sat next to him and he wrote some code into the CgProgram node, which
didnt yield anything, not even an error message (Node set to compile and execute) After digging on XSIWiki we found out that one has to install the CgToolkit first. Good to know, 'cause the XSI help files won't tell you.
We installed the latest version from Nvidia (which is Cg-1.5_Feb2007_Setup.exe).


Upon restarting the computer, starting XSI and loading the scene again (which contains a poly sphere, a CgProgram shading node wired to a OGL13Draw node, which feeds into the material) with an ultra simple Cg code snippet yields:

WARNING : 3000 - RTShader - A procedure couldn't be found in library: Cg_Shaders.dll. The library will not be loaded.: (PATH)\Cg_Shaders.dll

A little more testing revealed that this error comes up every time I create a Cg-related node, so the problem cannot lie with the Cg code entered in the CgProgram nodes text box.
An XSIWiki search later I know that there are other error messages known that sound quite similar and also have to do with the Cg_Shaders.dll, namely:



http://softimage.wiki.avid.com/index.php/Troubleshooting_-_WARNING_:_3000_-_RT_shader_DLL_(Cg_Shaders.dll)_not_found_in_path
and


http://softimage.wiki.avid.com/index.php/Troubleshooting_-_WARNING_:_3000_-_Missing_OpenGL_extension
The first one suggests adding the CG toolkit binary path to the system variables PATH settings and making sure that
at least Cg toolkit Beta 2 is used (I installed the final one from feb 2007). So just to make sure I downloaded and
installed beta 2 and tried again, and added the correct path to the PATH system and user variable. -> Still the same error message comes
up.
The second wiki link suggests to use a utility to check whether the graphics card supports ARB_Shadow and ARB_Multitexture extensions. GlInfo (a little freeware utility for OopenGL doagnostics) says
my card does (an Nvidia Quadro 560 btw).


Last resort was to install the very latest Quadro drivers. But that didn't help either.
So 3 hrs later here I am. Any suggestions?



-------- Original-Nachricht --------
Datum: Mon, 07 May 2007 19:31:12 +0200
Von: "André Adam" <a_adam(at)49games.de>
An: XSI(at)Softimage.COM
Betreff: Re: How to blend 2 textures based on vertex alpha values in realtime viewports




Don't know about your exact time schedule, but knocking up an RT-Shader which does what you want should take an experienced programmer one or two days. The OGL Shaders have the advantage that you can actually work on top of them, while the DX ones open up in a seperate viewport which does not show selections, wireframes, etc...

   -André


Fred Jacob wrote:
Thx Andy for the thorough reply.

I need this for a game we're working on that does the same blending
at
runtime, so there's no point in baking maps or rendering anything at all.
"Writing" a shader is what I did by using ShaderFX, which is more
like
connecting nodes and exporting the resulting shader code
as an *.fx file. However, loading the fx file in XSI "works" (that
is:
it does not crash) by loading it through the DXFX2 DX9 shading node,
but
does not render anything.
See attached fx file for reference if you dare.

What would be the benefit of using Cg over DX?
Are there graphical editors that can output Cg code? I was hoping for
Mental Mill but that's not released yet as it seems.
The thing is I really don't want to get into shader programming right
now as our time schedule is really tight.
Thanks again for your input,

Stefan
-------- Original-Nachricht --------
Datum: Sat, 05 May 2007 16:30:40 +0200
Von: Andy Jones <andy(at)thefront.com>
An: XSI(at)Softimage.COM
Betreff: Re: How to blend 2 textures based on vertex alpha values in
realtime viewports
Hey Stefan,

I have four approaches I can propose. The first would involve coding a
custom cg shader yourself, or having someone else do it. This all happens in the interface, so it's not as bad as having to write a
shader
in C or something (though generally, I'd say writing MR shaders in C
can
be easier than writing RT shaders in cg, depending on what you're doing). Having to write some code to do something like what you're describing is ultimately not such a bad thing, as once you know how to code these things, you can pretty much do anything you think of within the limits of the hardware. This is the solution I recommend. To access the vertex colors in XSI with a cg shader, you use the COLOR0 semantic. This is also handy in general, because even if you don't
have
a vertex color map, it reads the diffuse color. At least, that's how I
remember it working... My experience doing this in XSI has mostly
been
with the CGProgram node. But if I were starting all over, I'd probably
try to do everything with the .fx plugin. You can definitely do what you're trying to do with custom cg programs.


The other possible solution I know for doing texture blending, which
I'm
not even sure works, is to use a 2-pass shader with the standard OpenGL
nodes. Basically, this just means you have to OpenGL Draw nodes in the
shader. Each draws something to the screen. So, in this case, each
one
would draw one of the textures and you'd have to attenuate them
somehow,
via the blending modes in the draw node. But I'm not actually sure if you can read the vertex colors from any of the OpenGL nodes, so that might not actually work.

The third option is to set up a mental ray shader and just rendermap it. Whether that's useful depends on what you're doing, but a lot of times it's just way easier and faster to do complicated stuff like this
with MR. In a few cases, I've foolishly squandered hours trying to do things in realtime, when sometimes just doing it in MR and dealing with
non real-time viewport updates just isn't so bad.


The fourth option would be to use the FX tree to do the texture
blending
for you, onto a single clip. Although, there might be somedifficulty with the vertex colors. I suppose you could rendermap those... But it
all depends on what your workflow is.


Hope this helps.

-Andy

Fred Jacob wrote:

Good morning list!

I've been trying to set up a shading network that would show 2
textures
blended over each other on a per vertex alpha value basis.
I want to paint the vertex alpha values using the paint tool, but I
don't
want to render region after every paint stroke I do to see the
effect
so I
need this to be displayed in realtime.
So far I was not very successful in setting up a realtime shader
that
would
do that. I tried with the fixed function DX, Cg and OpenGl shading
nodes
XSI provides out of the box to no avail, and I also tried using an
fx
file
I created with the ShaderFX plugin for 3dsMax (which seems to fail
to
render in XSI propery because the shader queries the vertex colors in a
Max-compatible way, which seems to be different in XSI).
Any hint towards an alternative approach, a link to a working
OpenGL
shader (or whatever allows me to work in the viewports, 'cause in
DirectX
display mode no tools seem to display
correctly, including manipulators of the SRT tools and the paint
tools,
which renders DX display a bit useless in the first place) is highly
appreciated.
Also, I was wondering if there are any plans to integrate Mental
Mill
into XSI at some point.
Thanks a lot,

Stefan










---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.