XNA Game Development Forums
2012/05/18 06:23:59 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: 1 ... 3 4 [5]
  Print  
Author Topic: Bumpmap Shader  (Read 21675 times)
EclipsE
Full Member
***
Offline Offline

Posts: 111


View Profile
« Reply #60 on: 2007/05/24 12:54:44 »

I now found out why your models appeared incorrect... You used tangents but they weren't present

VS_OUTPUT VS(float4 Pos : POSITION,float2 Tex : TEXCOORD,float3 Normal : NORMAL,float3 Tangent : TANGENT)

omg...


Code:
        public override ModelContent Process(NodeContent input, ContentProcessorContext context)
        {
            GenerateTangents(input, context);
        }

        /// <summary>
        /// Generate tangents helper method, x files do not have tangents
        /// exported, we have to generate them ourselfs.
        /// </summary>
        /// <param name="input">Input data</param>
        /// <param name="context">Context for logging</param>
        private void GenerateTangents(
            NodeContent input, ContentProcessorContext context)
        {
            MeshContent mesh = input as MeshContent;
            if (mesh != null)
            {
                // Generate tangents for the mesh. We don't want binormals,
                // so null is passed in for the last parameter.
                MeshHelper.CalculateTangentFrames(mesh,
                    VertexChannelNames.TextureCoordinate(0),
                    VertexChannelNames.Tangent(0), null);
            }

            // Go through all childs
            foreach (NodeContent child in input.Children)
            {
                GenerateTangents(child, context);
            }
        }

Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #61 on: 2007/05/25 00:46:23 »

... Thats what I said, anyway, Nemo, look in your XNA book, he has code in there for Tangent space calculation, use that.
As for the SDK thing, the runtime is installed with the SDK during the installation process, it's hidden in the background when you run the install. But as I said, the runtime cannot be uninstalled and is overwritten by a newer one, so uninstalling an old SDK will make no difference, nor will uninstalling you latest SDK since the runtime wont be removed.
Basically, if its got anything to do with DirectX being the cause, which we know it isnt now, uninstalling a SDK won't make any difference.
Logged

Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #62 on: 2007/05/25 00:49:40 »

Thanks guys, I will look into this tangent disaster a little closer. Only thing is it does not explain the issue coming and going....

As far as the SDK stuff goes, I was implying that the old runtime may have been at fault, or at the very least, my version. Any way it is neither here nor there now. So with any luck this night mare is over and this thread can die  Cool

Hope this works for you MasterU..
Logged
EclipsE
Full Member
***
Offline Offline

Posts: 111


View Profile
« Reply #63 on: 2007/05/25 05:23:40 »

The code i put up, is the content processor which you can use to calculate tangents
Logged
Arkcann
Newbie
*
Offline Offline

Posts: 23


View Profile
« Reply #64 on: 2007/05/30 09:16:27 »

I had a problem with wierd blinking and shapes appearing on my bumpmapped objects, and I think it had something to do with my matrix multiplications, I haven't really been messing with my normal/bump mapping shaders though they don't cause the problem anymore as I removed the "to tangent space matrix", which seems to work though I'm not sure if it is true normal mapping without that. I now that if you base your normal mapping shader off of those used with Rendermonkey there are some unneccessary things (such as a to view space matrix) because they define their lights in a different way then the HMEngine would. Ohwell, lately I've been working on post-processing effects (HDR  Smiley) more than model shaders. This is off topic, but has anyone recieved an OutOfVideoMemory error? I get them from time to time and have to restart my computer to get rid of them. If anyone knows how to fix this some help would be apprieciated <- might deserve it's own topic. Anyways, I'd like to hear any advances made with this normal mapping problem.
Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #65 on: 2007/06/24 14:16:26 »

Guys,

Thanks I think the missing tangent data is what was causing my issue, MastetU, did this preprocessor fix your issues?? I am yet to give it a good test, but the results so far are good.

Thanks all.

Arkcann, I suggest starting a new thread for that issue, but I have had a similar issue when not setting the memory size correctly for custom vertex formats, to correct it I simply specified the size correctly and it was then all good.
« Last Edit: 2007/06/24 15:04:21 by Nemo Krad » Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #66 on: 2007/06/24 15:01:05 »

Yep,

looking good so far, this is an image of my self shadowing bump map effect, well Wolfgang Engles, but in my engine Smiley

[attachment deleted by admin]
« Last Edit: 2007/06/24 15:10:33 by Nemo Krad » Logged
masterU
Newbie
*
Offline Offline

Posts: 8



View Profile
« Reply #67 on: 2007/07/03 08:56:42 »

Hi!

I had no time to work on the problem, but it seems that you find the error...
I will try it the next days by myself.

thanks in advance,
masterU
Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #68 on: 2007/09/02 14:36:44 »

Right,

Kind of thought this was fixed but turns out it's not 100%

If I remove my terrain object from the scene then the bump mapping seems to go all squiffy again, not as bad as before, but still poop.

I now have the Tangent, BiNormal and Normal calcs in my content processor which seemed to fix most of my issues but I am still getting this odd error when my terrain is not there.

The first picture is of my model with the terrain in the draw call (though well out of shot) and the other is with it removed. Any of you got an ideas as to what is going on???

My terrain object and the related shaders do not alter any render states by the way.

[attachment deleted by admin]
Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #69 on: 2007/09/03 02:25:54 »

Again, this issue gets odder....

I can get the bad bump effect with the terrain object loading if I have a terrain map that is 46 X 46 (or greater) it still works fine, but 45 X 45 and I get the issue... This comes out at 2116 verts, now this does not leap out to me as one of those magic numbers, but I have been on holiday and my brain is probably not fully engaged....

any one got any ideas??
« Last Edit: 2007/09/03 02:34:42 by Nemo Krad » Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #70 on: 2007/09/06 13:15:22 »

OK,

Finally got the bugger fixed!

Take a look at this thread on the creators club for the trail of madness http://forums.xna.com/thread/23266.aspx

A big thanks to Leaf yet again for helping me out.

[attachment deleted by admin]
« Last Edit: 2007/09/06 13:18:56 by Nemo Krad » Logged
Pages: 1 ... 3 4 [5]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Shader compiler General Discussion endre 2 2367 Last post 2006/08/12 01:24:40
by Chr0n1x
Shader implemented fixed function Hazy Mind XNA Engine mikeschuld 2 2358 Last post 2006/11/07 02:07:22
by mikeschuld
Shader tutorials General Discussion endre 2 2240 Last post 2006/12/22 18:12:48
by mikeschuld
My Shader Hell... General Discussion « 1 2 » Nemo Krad 17 5360 Last post 2007/02/09 21:12:14
by Chr0n1x
What's wrong with my shader? :'( Hazy Mind XNA Engine EclipsE 6 2636 Last post 2007/03/06 15:43:17
by EclipsE
Point Light Shader General Discussion Nemo Krad 0 2034 Last post 2007/03/18 07:18:13
by Nemo Krad
Model & Shader Problems Hazy Mind XNA Engine Themodem 5 2064 Last post 2007/03/26 11:12:53
by Tiago
Terrain with Bumpmap Show Off Board Nemo Krad 8 3950 Last post 2007/06/29 01:22:38
by Nemo Krad
Playing with lighting : intermediate shader techniques? Hazy Mind XNA Engine 5parrowhawk 3 2297 Last post 2009/03/18 23:04:27
by Chr0n1x
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.063 seconds with 18 queries.