Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Materials in DX8
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 01 2004 :  10:05:09 AM  Show Profile  Reply with Quote
Hello again...

OK, I am currently designing a game based in outer space. I found it neccesary to create a particle system to represent the stars... However, when I render the stars, they are alway a light blue color, as opposed to white. I discovered this was because the previous object I rendered had a blue material. My question is, how do you "unset" a material, because I cannot for the life of me figure it out.

PS - I have also tried creating a white material, but I get errors when I do that...

Edited by - Sr. Guapo on Jun 01 2004 11:41:51 AM

ardman
Squire

15 Posts

Posted - Jun 01 2004 :  10:29:17 AM  Show Profile  Visit ardman's Homepage  Reply with Quote
Can you not post the code of when you're rendering the objects?


Cheers! :)
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 01 2004 :  10:59:36 AM  Show Profile  Reply with Quote
Sure

  
D3DDevice.BeginScene  
  
      'Draw The Stars  
            D3DDevice.SetVertexShader FVF_PARTICLEVERTEX  
            D3DDevice.SetRenderState D3DRS_ALPHABLENDENABLE, 1  
            D3DDevice.SetRenderState D3DRS_ZWRITEENABLE, 0  
            D3DDevice.SetTexture 0, StarTexture  
            D3DDevice.SetTransform D3DTS_WORLD, matStars  
  
            D3DDevice.DrawPrimitiveUP D3DPT_POINTLIST, NumOfStars, _  
                 StarVertexList(0), Len(StarVertexList(0))  
  
            D3DDevice.SetRenderState D3DRS_ZWRITEENABLE, 1  
            D3DDevice.SetRenderState D3DRS_LIGHTING, True
  
            'Mesh  
            D3DDevice.SetTransform D3DTS_WORLD, matShip  
            For I = 0 To nMaterials - 1  
                  '//Setup the renderer for this part of the mesh  
                  D3DDevice.SetMaterial MeshMaterials(I)  
                  D3DDevice.SetTexture 0, MeshTextures(I)  
  
                  '//Draw the current part of the mesh  
                  Mesh.DrawSubset I  
            Next I  
            D3DDevice.SetTransform D3DTS_WORLD, matWorld  
  
...  
  


Hope that helps...

Edited by - Sr. Guapo on Jun 01 2004 11:02:46 AM
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - Jun 01 2004 :  11:14:19 AM  Show Profile  Reply with Quote
What's the code for creating the white material?

Whatever. Who knows...
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 01 2004 :  11:25:39 AM  Show Profile  Reply with Quote
Well I know it was wrong... I can't figure out how to set the ambient/diffuse/emissive/power/specular properties. I tries RGB, Hex codes, even the native vb Colors (vbWhite...). I got an error saying "type mismatch" at the line where I tried to set them... I don't think you can just do

  
BlankMaterial.ambient = &HFFFFFF  
  


or whatever... Is there a special function in the D3DX library
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 01 2004 :  11:30:02 AM  Show Profile  Reply with Quote
Oh yeah... I have also tried

  
D3DDevice.setMaterial Nothing  
  


but that did not work either, I got a "ByRef Type Mismath" or something to that effect...
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - Jun 01 2004 :  7:27:44 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
Have you tried D3DColorARGB(Alpha, Red, Green, Blue)... this is what I use to set up colors in DirectX8, it has worked in every situation I've run in to... but there are exceptions..

DaBooda out...


DaBooda Team is back: http://dabooda.789mb.com/
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - Jun 01 2004 :  7:30:19 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
One more thing, did anybody else get that error when entering vbgamer, I have noticed that it stopped when I wrote this last comment, I am wondering if the code snippets are causing that, because all the forum posts have those little tooltips... maybe it was just me...

DaBooda Out...

DaBooda Team is back: http://dabooda.789mb.com/
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - Jun 01 2004 :  8:11:16 PM  Show Profile  Reply with Quote
Hum... what error?

Whatever. Who knows...
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - Jun 01 2004 :  8:14:04 PM  Show Profile  Reply with Quote
Oh found it. You need to pass a "D3DCOLORVALUE" type. So define a variable of this type and define the a,r,g,b components separately.

Whatever. Who knows...
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 01 2004 :  8:21:32 PM  Show Profile  Reply with Quote
I am getting the error too... It is getting really annoying... "Unterminated String Constant, do you wish to debug?" or something. I hate VS .NET, every time I hit an error on a page, it has to ask if I want to debug it...

Back to the topic: When VB gives me the error, it actually highlights the "ambient" (or whatever) parameter. I just don't think you are allowed to directly set the value.

I implemented a *VERY* low tech solution... I made another material (completely white) when I made the object (in Milkshape3D), then, through trial and error, found its index and set that immediatly before rendering the stars. It seems to work, though nobody else could understand the code...
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 01 2004 :  8:28:46 PM  Show Profile  Reply with Quote
OK, just saw your second comment VBBR... yup, I think that did it... thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.19 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.