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

Date : Tue, 08 May 2007 12:35:58 +0200
To : XSI(at)Softimage.COM
From : "Fred Jacob" <3freduard(at)gmx.de>
Subject : Re: How to blend 2 textures based on vertex alpha values in realtime viewports
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

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

---
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.