Original Post
🔒 Locked
Alpha
Advertisement
Hi there ZMax,
How are you doing buddy?
The Problem
Color of an object is (255, 0, 0, 0) and not visible?
The Solution
Let's say you have a black background and set your color to (255, 0, 0, 0). If this is a CustomVertex.PositionColored vertex formatted object, you will not see the quad if light is disabled ;) why? Cause the object is the same color as the background. Although it's being rendered it's a "logical problem" that the object will not be visible.
Now let's say the the format is CustomVertex.PositionColored and there is light enabled. This object will not be visible when rendered since the normal information is wrong and DirectX doesn't know how to handle the lighting of the object.
Also if you have a PositionNormalColored object and the light is enabled and it hits the object and the backbuffer is cleared to black. It won't show since you have made another logical error.
So.
1) Just make sure that the light is correctly hitting the object
2) Make sure that you aren't making a funny logical problem.
3) Make sure that the normals of the object is correct
PS: Just check and see what happens when you clear the back buffer to another color or changing the color of the vertices of your object.
I hope this helps buddy.
How are you doing buddy?
The Problem
Color of an object is (255, 0, 0, 0) and not visible?
The Solution
Let's say you have a black background and set your color to (255, 0, 0, 0). If this is a CustomVertex.PositionColored vertex formatted object, you will not see the quad if light is disabled ;) why? Cause the object is the same color as the background. Although it's being rendered it's a "logical problem" that the object will not be visible.
Now let's say the the format is CustomVertex.PositionColored and there is light enabled. This object will not be visible when rendered since the normal information is wrong and DirectX doesn't know how to handle the lighting of the object.
Also if you have a PositionNormalColored object and the light is enabled and it hits the object and the backbuffer is cleared to black. It won't show since you have made another logical error.
So.
1) Just make sure that the light is correctly hitting the object
2) Make sure that you aren't making a funny logical problem.
3) Make sure that the normals of the object is correct
PS: Just check and see what happens when you clear the back buffer to another color or changing the color of the vertices of your object.
I hope this helps buddy.
The normals are all set to up vector3(0,1,0) the light is directional vector3(0,-1,0) comming from the sky :)),all vertices youse this color(255,0,0,0) i think they should be invisible no?I don't know if they should or no,..i haven't did this before.
When i'm using a texture i set this color for the vertices color(255,255,255,255) so a white with full alpha.White because the ligth combines the texture color with the material color...it is better to be white :))
Anyway My question is...if i don't use texture, i have only a full alpha color on my vertices,..a ligth that comes from the sky should i or shouldn't i see trough my surface?Mabe i shouldn't i don't know. :))
When i'm using a texture i set this color for the vertices color(255,255,255,255) so a white with full alpha.White because the ligth combines the texture color with the material color...it is better to be white :))
Anyway My question is...if i don't use texture, i have only a full alpha color on my vertices,..a ligth that comes from the sky should i or shouldn't i see trough my surface?Mabe i shouldn't i don't know. :))
255 alpha means fully opaque. 0 alpha means fully transparent. So you're getting the correct behaviour.
Aside from that, have you enabled alpha blending? You'll want to se the D3DRS_ALPHABLENDENABLE render state to TRUE, and probably set D3DRS_SRCBLEND to D3DBLEND_SRCALPHA and D3DRS_DESTBLEND to D3DBLEND_INVSRCALPHA.
Aside from that, have you enabled alpha blending? You'll want to se the D3DRS_ALPHABLENDENABLE render state to TRUE, and probably set D3DRS_SRCBLEND to D3DBLEND_SRCALPHA and D3DRS_DESTBLEND to D3DBLEND_INVSRCALPHA.
Hi there buddy :)
How are you doing?
The Problem
Camera position/ Coloring/ Alpha
The Solution
This totally depends on where your camera is. If your camera position is at (0.0f, 0.0f, 0.0f) and your object is at 0.0f, 0.0f (anything) it might be difficult to see the result.
The normal and the light seem fine. If it's a directional light I see no problem.
Could you perhaps your code. It would be faster than to try and guess ? There might be a small thing wrong and i'm shooting in the dark here ;)
- Your primitive creation code.
- Your lighting code and rendering code.
Thank you buddy. Sorry for the delay.
How are you doing?
The Problem
Camera position/ Coloring/ Alpha
The Solution
This totally depends on where your camera is. If your camera position is at (0.0f, 0.0f, 0.0f) and your object is at 0.0f, 0.0f (anything) it might be difficult to see the result.
The normal and the light seem fine. If it's a directional light I see no problem.
Could you perhaps your code. It would be faster than to try and guess ? There might be a small thing wrong and i'm shooting in the dark here ;)
- Your primitive creation code.
- Your lighting code and rendering code.
Thank you buddy. Sorry for the delay.
I succeded somehow to create that alpha using the texture too:
This is the way i'm doing in the render method,sub:
I'm creating the alpha so: it increases in the height so down should be very transparent and up opaque(I have a heightMap). Now i want to add the second texture but with other alpha values...very opaque down and trasnparent up.How could i add the 2 results,...do i need to render the scene 2 times?It is a better way of doing this without rendering the scene manny times?
P.s Evil Steve: thanx for all your help i rated you here as an excellent guy,..Thx again :)
This is the way i'm doing in the render method,sub:
device.SetTexture(0, VertexCls.Texture(0)) device.TextureState(0).ColorOperation = TextureOperation.SelectArg1 device.TextureState(0).ColorArgument1 = TextureArgument.TextureColor device.TextureState(0).ColorArgument2 = TextureArgument.Diffuse device.TextureState(0).AlphaOperation = TextureOperation.SelectArg1 device.TextureState(0).AlphaArgument1 = TextureArgument.Diffuse device.TextureState(0).AlphaArgument2 = TextureArgument.TextureColor 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa device.SetStreamSource(0, VertexCls.vertexBuffer, 0) device.Indices = VertexCls.indexBuffer ' set fill mode If FM Then device.RenderState.FillMode = FillMode.WireFrame Else device.RenderState.FillMode = FillMode.Solid End If device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, HeightMapCls.BmpWidth * HeightMapCls.BmpHeight, 0, HeightMapCls.BmpWidth * 6 * HeightMapCls.BmpHeight / 3)I'm creating the alpha so: it increases in the height so down should be very transparent and up opaque(I have a heightMap). Now i want to add the second texture but with other alpha values...very opaque down and trasnparent up.How could i add the 2 results,...do i need to render the scene 2 times?It is a better way of doing this without rendering the scene manny times?
P.s Evil Steve: thanx for all your help i rated you here as an excellent guy,..Thx again :)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement