It is currently Thu Sep 19, 2019 3:21 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Rare material pseudo-shadow
PostPosted: Thu Sep 05, 2019 5:55 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Jun 11, 2003 9:33 pm
Posts: 4578
Location: Spa, relaxing and thinking, and learning...
Have this.
As can see, there is not a natural way of the shadow: the material is in some way, auto-shadowed.
If do NormalizeMesh(1) before the entity is created (after mesh transformation), the issue get better, but still the shadow is not correct.

Any idea?

Code:
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
Global bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
Add3DArchive("media/",#PB_3DArchive_FileSystem)
Parse3DScripts()

CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,3,#PB_Absolute)

LoadMesh(1,"peg-toporiginal_3ds.mesh")
TransformMesh(1,0,0,0,1,1,1,270,0,0):UpdateMeshBoundingBox(1)
;GetScriptMaterial(2,"peg-toporiginal_3ds#2")

CreateEntity(0,MeshID(1),#PB_Material_None,0,0,0)
Repeat
  ExamineKeyboard()
  WindowEvent()
  rotateentity(0,0,1,0,#PB_Relative)
  TimeSinceLastFrame.i=RenderWorld(50)
  FlipBuffers()
  Delay(8)
Until KeyboardPushed(#PB_Key_Escape)


Needed data here:
https://file.io/z7LHWc

EDIT:
Damn ! :o
It is volatile. Those services (file.io) are not useful for this.

Take it from here:
https://mega.nz/#!B9gwzIyQ!ZPay9tie_lXi ... 9vHnI-I64Q
or:
http://s000.tinyupload.com/?file_id=319 ... 3489564400

_________________
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend


Last edited by Psychophanta on Fri Sep 06, 2019 12:57 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Thu Sep 05, 2019 8:21 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1368
Psychophanta , https://file.io/z7LHWc not available
404
Page not found
it is possible you have uploaded the file as .mesh not zip or .rar
you may find this free service useful: http://s000.tinyupload.com/index.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Fri Sep 06, 2019 12:55 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Jun 11, 2003 9:33 pm
Posts: 4578
Location: Spa, relaxing and thinking, and learning...
Edited,
Thanks applePi :)

_________________
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend


Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Sun Sep 08, 2019 8:53 am 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1368
Psychophanta, the following version is visually better and smoother, instead of loading the material from material peg-toporiginal_3ds#2
load it with CreateMaterial(2, LoadTexture(2, "madera2.jpg"))
and add the material to the entity CreateEntity(0,MeshID(1),MaterialID(2),0,0,0)
in your version it is possible the specular, diffuse, emmissive, ambient values needs adjustments
but what annoys me and the funny part of your mesh is the darker side of the "wooden Top" the right side of the "madera2.jpg" contribute to some of the dark, but the mesh itself have another reason, may be the normals, tangents, and even the clockwise or anticlockwise wise of the mesh triangle on either sides of the wooden Top. don't know until now.
note that if we do NormalizeMesh(1) the wooden Top will appears as old toy
Code:
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
Global bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
Add3DArchive("media/",#PB_3DArchive_FileSystem)
Parse3DScripts()

CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,3,#PB_Absolute)

CreateMaterial(2, LoadTexture(2, "madera2.jpg"))
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))

LoadMesh(1,"peg-toporiginal_3ds.mesh")
TransformMesh(1,0,0,0,1,1,1,270,0,0)
UpdateMeshBoundingBox(1)
;NormalizeMesh(1)

;GetScriptMaterial(2,"peg-toporiginal_3ds#2")

;CreateEntity(0,MeshID(1),#PB_Material_None,0,0,0)
CreateEntity(0,MeshID(1),MaterialID(2),0,0,0)
SetEntityMaterial(0, MaterialID(3), 1)
SetEntityMaterial(0, MaterialID(3), 0)

Repeat
  ExamineKeyboard()
  WindowEvent()
  RotateEntity(0,0,1,0,#PB_Relative)
  TimeSinceLastFrame.i=RenderWorld(50)
  FlipBuffers()
  Delay(8)
Until KeyboardPushed(#PB_Key_Escape)


Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Sun Sep 08, 2019 2:55 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Jun 11, 2003 9:33 pm
Posts: 4578
Location: Spa, relaxing and thinking, and learning...
Thank you applePi, you're a 3D master :wink:

EDIT:
However, shadows at the surface are still strange in this mesh, with or without 'NormalizeMesh(1)'

_________________
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend


Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Mon Sep 09, 2019 1:45 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1368
by chance i got a better "wooden top" shadow :
uniting all submeshes to one big mesh using the code in the last example in viewtopic.php?f=36&t=66068
then import it with deepmesh software viewtopic.php?f=14&t=46115&start=45#p456533
after changing its MeshSerializer_v1.8] to MeshSerializer_v1.40] by a hex-text editor like "emeditor" and export to *.ply use that *.ply file with OgreAssimpConverter.exe to provide again the *.mesh which are used for this demo. OgreAssimpConverter.exe is available at the OGRE tools thread at the top of the 3D forum
i have used also:
BuildMeshShadowVolume(1)
UpdateMeshBoundingBox(1)
WorldShadows(#PB_Shadow_Additive)

attached:
1-your mesh modified as one big mesh
2-top_ply.ply
3-top_ply_ply.mesh (this is what will be used)
http://www.filedropper.com/meshes

Image

Code:
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
Global bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
Add3DArchive("media/",#PB_3DArchive_FileSystem)
Parse3DScripts()

CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0.5,3,#PB_Absolute)
CameraLookAt(0,0,0,0)

CreateMaterial(2, LoadTexture(2, "madera2.jpg"))
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))
CreateMaterial(4, LoadTexture(4, "snow_1024.jpg"))
CreatePlane(7, 100,100, 1,1,1,1)
CreateEntity(7, MeshID(7), MaterialID(4), 0,-1.1,0)

;LoadMesh(1,"peg-toporiginal_3ds.mesh")
LoadMesh(1,"top_ply_ply.mesh") ;*****

;TransformMesh(1,0,0,0,1,1,1,270,0,0)
BuildMeshShadowVolume(1)
UpdateMeshBoundingBox(1)
;NormalizeMesh(1)

;GetScriptMaterial(2,"peg-toporiginal_3ds#2")

;CreateEntity(0,MeshID(1),#PB_Material_None,0,0,0)
CreateEntity(0,MeshID(1),MaterialID(2),0,0,0)
;SetEntityMaterial(0, MaterialID(3), 1)
;SetEntityMaterial(0, MaterialID(3), 0)
;WorldShadows(#PB_Shadow_Modulative)
WorldShadows(#PB_Shadow_Additive)
EntityRenderMode(0, #PB_Entity_CastShadow )


Repeat
  ExamineKeyboard()
  WindowEvent()
  RotateEntity(0,0,1,0,#PB_Relative)
  TimeSinceLastFrame.i=RenderWorld(50)
  FlipBuffers()
  Delay(8)
Until KeyboardPushed(#PB_Key_Escape)


Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Tue Sep 10, 2019 10:38 am 
Offline
Addict
Addict
User avatar

Joined: Wed Jun 11, 2003 9:33 pm
Posts: 4578
Location: Spa, relaxing and thinking, and learning...
Nice, the texture is oriented in the correct way in the central part of the body (wood part).
However, there is not a good idea to joint the 3 submeshes, because each part has to have a differente material.

By the way, i already converted the original to .mesh format, via OgreAssimpConverter.
Here are the 3 original models i have:
http://www.filedropper.com/3meshespegtop3ds

_________________
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend


Top
 Profile  
Reply with quote  
 Post subject: Re: Rare material pseudo-shadow
PostPosted: Wed Sep 11, 2019 1:10 pm 
Offline
Addict
Addict

Joined: Sun Jun 25, 2006 7:28 pm
Posts: 1368
Thanks Psychophanta for the Meshes,
Quote:
there is not a good idea to joint the 3 submeshes, because each part has to have a differente material

Thats right, but my reason is that DeepMesh software does not export the toy submeshes to *,ply correctly so i have tried to provide it as one mesh version.
for the one big mesh version there is a choice to color some parts with a different color, if we use "Ogre Meshy" viewer version 1.5 it show use that there is 3 submeshes with vertex counts 258, 257, 1066. in the following code version we color the bottom and top in red and green. but the color will not displayed until we use either worldshadow, or DisableMaterialLighting(2, #True) or the two together.

this code needs "top_ply_ply.mesh" posted above here posting.php?mode=reply&f=36&t=73562#pr541640
Code:
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
Global bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
Add3DArchive("media/",#PB_3DArchive_FileSystem)
Parse3DScripts()

CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0.5,3,#PB_Absolute)
CameraLookAt(0,0,0,0)

CreateMaterial(2, LoadTexture(2, "madera2.jpg"))
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))
CreateMaterial(4, LoadTexture(4, "snow_1024.jpg"))
;DisableMaterialLighting(2, #True)
CreatePlane(7, 100,100, 1,1,1,1)
CreateEntity(7, MeshID(7), MaterialID(4), 0,-1.1,0)

LoadMesh(1,"top_ply_ply.mesh")
Dim MeshData.PB_MeshVertex(0)
Dim MeshDataInd.PB_MeshFace(0)
GetMeshData(1,0, MeshData(), #PB_Mesh_Vertex | #PB_Mesh_UVCoordinate | #PB_Mesh_Normal | #PB_Mesh_Color, 0, MeshVertexCount(1)-1)
GetMeshData(1,0, MeshDataInd(), #PB_Mesh_Face, 0, MeshIndexCount(1, 0)-1)
FreeMesh(1)
CreateMesh(0, #PB_Mesh_TriangleList, #PB_Mesh_Dynamic)
ArrSize = ArraySize(MeshData())
  ;Debug ArrSize
  For c=0 To ArrSize
     
      x.f  = MeshData(c)\x
      y.f  = MeshData(c)\y
      z.f  = MeshData(c)\z
      MeshVertexPosition(x,y,z)
      If c<=257
        MeshVertexColor(RGB(255,0,0))
      ElseIf c>257 And c<257+258
        MeshVertexColor(RGB(0,255,0))
      Else
       
        MeshVertexColor(RGB(255,255,255))
      EndIf
     
      MeshVertexNormal(MeshData(c)\NormalX, MeshData(c)\NormalY, MeshData(c)\NormalZ)
      MeshVertexTextureCoordinate(MeshData(c)\u, MeshData(c)\v)
     
  Next
   
   
   ArrSizeInd = ArraySize(MeshDataInd())
   For i=0 To ArrSizeInd Step 3
     MeshFace(MeshDataInd(i)\Index, MeshDataInd(i+1)\Index,MeshDataInd(i+2)\Index)
   Next
   
   
   FinishMesh(#True)
   SetMeshMaterial(0, MaterialID(2))
   
  CreateEntity(0, MeshID(0), MaterialID(2), 0,40,0)
  ScaleEntity(0, 40,40,40)
   

;*****************************************************************************
BuildMeshShadowVolume(0)
UpdateMeshBoundingBox(0)
;NormalizeMesh(1)


;CreateEntity(0,MeshID(0),#PB_Material_None,0,0,0)
CreateEntity(0,MeshID(0),MaterialID(2),0,0,0)

;WorldShadows(#PB_Shadow_Modulative)
WorldShadows(#PB_Shadow_Additive)
EntityRenderMode(0, #PB_Entity_CastShadow )

Repeat
  ExamineKeyboard()
  WindowEvent()
  RotateEntity(0,0,1,0,#PB_Relative)
  TimeSinceLastFrame.i=RenderWorld(50)
  FlipBuffers()
  Delay(8)
Until KeyboardPushed(#PB_Key_Escape)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye