Re: How to blend 2 textures based on vertex alpha values in realtime viewports
| Date : Tue, 08 May 2007 13:38:13 +0200 |
| To : XSI(at)Softimage.COM |
| From : Andy Jones <andy(at)thefront.com> |
| Subject : Re: How to blend 2 textures based on vertex alpha values in realtime viewports |
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:
runtime, so there's no point in baking maps or rendering anything at all.Thx Andy for the thorough reply.
I need this for a game we're working on that does the same blending at
"Writing" a shader is what I did by using ShaderFX, which is more likeconnecting 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.
Mental Mill but that's not released yet as it seems.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
The thing is I really don't want to get into shader programming rightnow as our time schedule is really tight.
realtime viewportsThanks 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
shader
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
canin C or something (though generally, I'd say writing MR shaders in C
havebe 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
beena 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
I'mwith 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
onenot 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
somehow,would draw one of the textures and you'd have to attenuate them
blendingvia 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
texturesfor 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
don'tblended over each other on a per vertex alpha value basis.
I want to paint the vertex alpha values using the paint tool, but I
so Iwant to render region after every paint stroke I do to see the effect
nodesneed this to be displayed in realtime.
So far I was not very successful in setting up a realtime shader thatwould
do that. I tried with the fixed function DX, Cg and OpenGl shading
fileXSI provides out of the box to no avail, and I also tried using an fx
DirectXI 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 OpenGLshader (or whatever allows me to work in the viewports, 'cause in
tools,display mode no tools seem to display
correctly, including manipulators of the SRT tools and the paint
body: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 Millinto XSI at some point.
---Thanks a lot,
Stefan
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
---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
- Follow-Ups:
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- From: "Fred Jacob" <3freduard(at)gmx.de>
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- From: Christian Rittener <christian_list(at)b-cosmos.com>
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- References:
- How to blend 2 textures based on vertex alpha values in realtime viewports
- From: "Fred Jacob" <3freduard(at)gmx.de>
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- From: Andy Jones <andy(at)thefront.com>
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- From: "Fred Jacob" <3freduard(at)gmx.de>
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- From: André Adam <a_adam(at)49games.de>
- Re: How to blend 2 textures based on vertex alpha values in realtime viewpo
- From: "Fred Jacob" <3freduard(at)gmx.de>
- How to blend 2 textures based on vertex alpha values in realtime viewports
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Ambient Light Override
- Next by Date: Ambient Light Override
- Previous by Thread: Ambient Light Override
- Next by Thread: Ambient Light Override
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |