SR 3D Builder - Version 0.3.2.0 released
SR 3D Builder - Version 0.3.2.0 released
Hi everybody,
after 3 months of hard work (and some holidays) here it is.
The long awaited new SR 3D Builder version 0.3.2.0
Many news, but especially many code rewrites. Check history for a list of what
has been changed.
Dowload as usual from http://staff.polito.it/sergio.reano/
Enjoy building
Sergio
PS: if there is any DirectX GURU, I need some help to solve a problem !!!
Thanks
after 3 months of hard work (and some holidays) here it is.
The long awaited new SR 3D Builder version 0.3.2.0
Many news, but especially many code rewrites. Check history for a list of what
has been changed.
Dowload as usual from http://staff.polito.it/sergio.reano/
Enjoy building
Sergio
PS: if there is any DirectX GURU, I need some help to solve a problem !!!
Thanks
Re: SR 3D Builder - Version 0.3.2.0 released
Congratulations with your project!
What do you need to know about DirectX?
What do you need to know about DirectX?
Guilherme Santos
www.historybricks.com
www.historybricks.com
Re: SR 3D Builder - Version 0.3.2.0 released
Hi,
I wrote my personal effect shader to gain a backface lighting not available in DirectX.
The problem is that the code works fine with near all nVidia Card, but has huge problem with some of the most recent ATI Cards. It displays absolutely nothing about model but only the tracking cube around selected parts.
I was thinking that something is missed in passing parameters to effect shader, but everything seems ok.
You can take a look at the shader in BFL3.TXT to see if there is something wrong...
thanks for your help
Sergio
[quote="gads"]
Congratulations with your project!
What do you need to know about DirectX?
[/quote]
I wrote my personal effect shader to gain a backface lighting not available in DirectX.
The problem is that the code works fine with near all nVidia Card, but has huge problem with some of the most recent ATI Cards. It displays absolutely nothing about model but only the tracking cube around selected parts.
I was thinking that something is missed in passing parameters to effect shader, but everything seems ok.
You can take a look at the shader in BFL3.TXT to see if there is something wrong...
thanks for your help
Sergio
[quote="gads"]
Congratulations with your project!
What do you need to know about DirectX?
[/quote]
Re: SR 3D Builder - Version 0.3.2.0 released
Can you send me some images with the error just to make sure I understood what the problem is?
Meanwhile I will take a look into your shader.
PS: you can send me the images to my email: email [AT] guilherme-santos.net
Meanwhile I will take a look into your shader.
PS: you can send me the images to my email: email [AT] guilherme-santos.net
Última edição por gads em 25 ago 2008, 16:47, editado 1 vez no total.
Guilherme Santos
www.historybricks.com
www.historybricks.com
Re: SR 3D Builder - Version 0.3.2.0 released
This may look silly, but did you check if the alpha component is different from 0 on those ATI cards?
Maybe one of the operations is setting alpha to zero...
Try forcing alpha to 1 in the pixel shader, just to test.
Just guessing
Maybe one of the operations is setting alpha to zero...
Try forcing alpha to 1 in the pixel shader, just to test.
Just guessing
Guilherme Santos
www.historybricks.com
www.historybricks.com
Re: SR 3D Builder - Version 0.3.2.0 released
Hi,
I don't get any error messages, simply I get incorrect image display.
What line of my shader should look like? please can u send me my shader with the suggested correction?
Thanks
Sergio
[quote="gads"]
This may look silly, but did you check if the alpha component is different from 0 on those ATI cards?
Maybe one of the operations is setting alpha to zero...
Try forcing alpha to 1 in the pixel shader, just to test.
Just guessing
[/quote]
I don't get any error messages, simply I get incorrect image display.
What line of my shader should look like? please can u send me my shader with the suggested correction?
Thanks
Sergio
[quote="gads"]
This may look silly, but did you check if the alpha component is different from 0 on those ATI cards?
Maybe one of the operations is setting alpha to zero...
Try forcing alpha to 1 in the pixel shader, just to test.
Just guessing
[/quote]
Re: SR 3D Builder - Version 0.3.2.0 released
Sorry about the confusion!
When I said "Error" I mean the incorrect rendering. I was asking for a screenshot that shows the problem you are describing
For example, you have
OUT.DL = Diffuse * LightDColor * dot(N, LightDir);
Try instead
OUT.DL = Diffuse * LightDColor * float4(dot(N, LightDir), 1);
It's a long shot, but at least this way you confirm that alpha it's correct.
When I said "Error" I mean the incorrect rendering. I was asking for a screenshot that shows the problem you are describing
For example, you have
OUT.DL = Diffuse * LightDColor * dot(N, LightDir);
Try instead
OUT.DL = Diffuse * LightDColor * float4(dot(N, LightDir), 1);
It's a long shot, but at least this way you confirm that alpha it's correct.
Guilherme Santos
www.historybricks.com
www.historybricks.com
Re: SR 3D Builder - Version 0.3.2.0 released
I try your hint, but get no appreciable results.
tomorrow, if I have time, I'll send you a image of the rendering, but consider view only the surrounding box that track the current brick under mouse cursor and the grid if you click on a brick (or part)
this means that positioning calculation is correct but something goes wrong probably in matrices.
here is a the part of my code that performs rendering:
have a look. hope is not too complex...
--------------------------------------------------
F = Effect.FromFile(DV, AppPath & "\BFL3.txt", Nothing, "", ShaderFlags.SkipValidation Or ShaderFlags.PreferFlowControl, EP, s)
If s <> "" Then
MsgBox("Effect Shader Compilation ERROR:" & s, MsgBoxStyle.Critical, AppName)
End
End If
hW = F.GetParameter(Nothing, "mWorld")
hWP = F.GetParameter(Nothing, "mWorldP")
hC = F.GetParameter(Nothing, "CameraPos")
hD = F.GetParameter(Nothing, "Diffuse")
SP = F.GetParameter(Nothing, "Specular")
SH = F.GetParameter(Nothing, "Shiness")
Tec1 = F.GetTechnique("TAndLV")
F.Technique = Tec1
F.CommitChanges()
--------------------------------------------------
If IsRendering Then Exit Sub
IsRendering = True
If Environment.TickCount - T > 1000 Then
If FrameRT > 0 Then RaiseEvent FPSChange(FrameRT / (Environment.TickCount - T) * 1000)
T = Environment.TickCount
FrameRT = 0
End If
DV.Clear(ClearFlags.ZBuffer + ClearFlags.Target, BCKc, 1.0F, 1)
'mW = World Transformation Matrix
'mWIT = Inverse-Transposed of M (for Normal Management)
F.SetValue(hC, vLookFrom4)
'Begin Scene
F.Begin(FX.None)
F.BeginPass(0)
DV.BeginScene()
'Render all bricks/block - First Solid...
For j = UBound(Block) To 0 Step -1
If Block(j).NBrick > 0 Then
mWIT = Matrix.Multiply(Block(j).mTrans, mWorld)
mWIT.Multiply(mView)
mW = Matrix.Multiply(mWIT, mProj)
mWIT.Invert()
mWIT.Transpose(mWIT)
F.SetValue(hWP, mW)
F.SetValue(hW, mWIT)
F.CommitChanges()
RenderSolid(j)
End If
Next
DV.EndScene()
F.EndPass()
F.End()
DV.Present()
FrameRT += 1
IsRendering = False
--------------------------------------------------
Private Sub RenderSolid(ByVal j As Integer)
Dim i As Integer
For i = 0 To UBound(Block(j).SubBl)
With Block(j).SubBl(i)
If .Color > -1 And Not IsNothing(.VB) Then
If (ColArr(.Color).Col.Alpha = 1 And j > 0) Then
F.SetValue(SH, ColArr(.Color).Shiness)
F.SetValue(SP, ColArr(.Color).Specular)
F.SetValue(hD, ColArr(.Color).Col)
F.CommitChanges()
#If Debug And shw Then
If i = 0 Then
If .N4.Length > 1 Then
DV.SetStreamSource(0, .NB, 0, sV3)
DV.DrawPrimitives(PrimitiveType.LineList, 0, (.N4.Length - 1) / 2)
End If
End If
#End If
If .iasVB.Length > 1 Then
DV.SetStreamSource(0, .sVB, 0, sCV)
DV.Indices = .isVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, .iasVB.Length - 1, 0, (.iasVB.Length - 1) / 3)
End If
If .iaVB.Length > 1 Then
DV.SetStreamSource(0, .VB, 0, sCV)
DV.Indices = .iVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, (.iaVB.Length - 1), 0, (.iaVB.Length - 1) / 3)
End If
ElseIf j = 0 And Block(0).NBrick = 1 And ColArr(.Color).Col.Alpha <> 1 Then
DV.RenderState.AlphaBlendEnable = True
F.SetValue(SH, ColArr(.Color).Shiness)
F.SetValue(SP, ColArr(.Color).Specular)
F.SetValue(hD, ColArr(.Color).Col)
F.CommitChanges()
#If Debug And shw Then
If i = 0 Then
If .N4.Length > 1 Then
DV.SetStreamSource(0, .NB, 0, sV3)
DV.DrawPrimitives(PrimitiveType.LineList, 0, (.N4.Length - 1) / 2)
End If
End If
#End If
If .iasVB.Length > 1 Then
DV.SetStreamSource(0, .sVB, 0, sCV)
DV.Indices = .isVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, .iasVB.Length - 1, 0, (.iasVB.Length - 1) / 3)
End If
If .iaVB.Length > 1 Then
DV.SetStreamSource(0, .VB, 0, sCV)
DV.Indices = .iVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, (.iaVB.Length - 1), 0, (.iaVB.Length - 1) / 3)
End If
DV.RenderState.AlphaBlendEnable = False
End If
End If
End With
Next
End Sub
--------------------------------------------------
[quote="gads"]
Sorry about the confusion!
When I said "Error" I mean the incorrect rendering. I was asking for a screenshot that shows the problem you are describing
For example, you have
OUT.DL = Diffuse * LightDColor * dot(N, LightDir);
Try instead
OUT.DL = Diffuse * LightDColor * float4(dot(N, LightDir), 1);
It's a long shot, but at least this way you confirm that alpha it's correct.
[/quote]
tomorrow, if I have time, I'll send you a image of the rendering, but consider view only the surrounding box that track the current brick under mouse cursor and the grid if you click on a brick (or part)
this means that positioning calculation is correct but something goes wrong probably in matrices.
here is a the part of my code that performs rendering:
have a look. hope is not too complex...
--------------------------------------------------
F = Effect.FromFile(DV, AppPath & "\BFL3.txt", Nothing, "", ShaderFlags.SkipValidation Or ShaderFlags.PreferFlowControl, EP, s)
If s <> "" Then
MsgBox("Effect Shader Compilation ERROR:" & s, MsgBoxStyle.Critical, AppName)
End
End If
hW = F.GetParameter(Nothing, "mWorld")
hWP = F.GetParameter(Nothing, "mWorldP")
hC = F.GetParameter(Nothing, "CameraPos")
hD = F.GetParameter(Nothing, "Diffuse")
SP = F.GetParameter(Nothing, "Specular")
SH = F.GetParameter(Nothing, "Shiness")
Tec1 = F.GetTechnique("TAndLV")
F.Technique = Tec1
F.CommitChanges()
--------------------------------------------------
If IsRendering Then Exit Sub
IsRendering = True
If Environment.TickCount - T > 1000 Then
If FrameRT > 0 Then RaiseEvent FPSChange(FrameRT / (Environment.TickCount - T) * 1000)
T = Environment.TickCount
FrameRT = 0
End If
DV.Clear(ClearFlags.ZBuffer + ClearFlags.Target, BCKc, 1.0F, 1)
'mW = World Transformation Matrix
'mWIT = Inverse-Transposed of M (for Normal Management)
F.SetValue(hC, vLookFrom4)
'Begin Scene
F.Begin(FX.None)
F.BeginPass(0)
DV.BeginScene()
'Render all bricks/block - First Solid...
For j = UBound(Block) To 0 Step -1
If Block(j).NBrick > 0 Then
mWIT = Matrix.Multiply(Block(j).mTrans, mWorld)
mWIT.Multiply(mView)
mW = Matrix.Multiply(mWIT, mProj)
mWIT.Invert()
mWIT.Transpose(mWIT)
F.SetValue(hWP, mW)
F.SetValue(hW, mWIT)
F.CommitChanges()
RenderSolid(j)
End If
Next
DV.EndScene()
F.EndPass()
F.End()
DV.Present()
FrameRT += 1
IsRendering = False
--------------------------------------------------
Private Sub RenderSolid(ByVal j As Integer)
Dim i As Integer
For i = 0 To UBound(Block(j).SubBl)
With Block(j).SubBl(i)
If .Color > -1 And Not IsNothing(.VB) Then
If (ColArr(.Color).Col.Alpha = 1 And j > 0) Then
F.SetValue(SH, ColArr(.Color).Shiness)
F.SetValue(SP, ColArr(.Color).Specular)
F.SetValue(hD, ColArr(.Color).Col)
F.CommitChanges()
#If Debug And shw Then
If i = 0 Then
If .N4.Length > 1 Then
DV.SetStreamSource(0, .NB, 0, sV3)
DV.DrawPrimitives(PrimitiveType.LineList, 0, (.N4.Length - 1) / 2)
End If
End If
#End If
If .iasVB.Length > 1 Then
DV.SetStreamSource(0, .sVB, 0, sCV)
DV.Indices = .isVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, .iasVB.Length - 1, 0, (.iasVB.Length - 1) / 3)
End If
If .iaVB.Length > 1 Then
DV.SetStreamSource(0, .VB, 0, sCV)
DV.Indices = .iVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, (.iaVB.Length - 1), 0, (.iaVB.Length - 1) / 3)
End If
ElseIf j = 0 And Block(0).NBrick = 1 And ColArr(.Color).Col.Alpha <> 1 Then
DV.RenderState.AlphaBlendEnable = True
F.SetValue(SH, ColArr(.Color).Shiness)
F.SetValue(SP, ColArr(.Color).Specular)
F.SetValue(hD, ColArr(.Color).Col)
F.CommitChanges()
#If Debug And shw Then
If i = 0 Then
If .N4.Length > 1 Then
DV.SetStreamSource(0, .NB, 0, sV3)
DV.DrawPrimitives(PrimitiveType.LineList, 0, (.N4.Length - 1) / 2)
End If
End If
#End If
If .iasVB.Length > 1 Then
DV.SetStreamSource(0, .sVB, 0, sCV)
DV.Indices = .isVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, .iasVB.Length - 1, 0, (.iasVB.Length - 1) / 3)
End If
If .iaVB.Length > 1 Then
DV.SetStreamSource(0, .VB, 0, sCV)
DV.Indices = .iVB
DV.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, (.iaVB.Length - 1), 0, (.iaVB.Length - 1) / 3)
End If
DV.RenderState.AlphaBlendEnable = False
End If
End If
End With
Next
End Sub
--------------------------------------------------
[quote="gads"]
Sorry about the confusion!
When I said "Error" I mean the incorrect rendering. I was asking for a screenshot that shows the problem you are describing
For example, you have
OUT.DL = Diffuse * LightDColor * dot(N, LightDir);
Try instead
OUT.DL = Diffuse * LightDColor * float4(dot(N, LightDir), 1);
It's a long shot, but at least this way you confirm that alpha it's correct.
[/quote]