Posts: 12
Threads: 3
Likes Received:
10 in 8 posts
Likes Given: 29
Joined: Jan 2024
Reputation:
5
01-23-2024, 07:54 PM
(This post was last modified: 01-24-2024, 05:46 AM by stevantosic .)
Hi
I noticed there is no difference between AddBackImage and AddImage in LD3DView
.
st
Posts: 451
Threads: 34
Likes Received:
359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
Hi st,
The difference is quite subtle, but AddBackImage applies to the back of an object and AddImage to the front. By default the back surface is not shown. Google 'GeometryModel3D.BackMaterial' for more info.
We should be able to see the effect with this
Code:
view3D = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
LD3DView.AutoControl("True","True",2,1)
LD3DView.AddDirectionalLight(view3D,"White",-0.612372,-0.5,-0.612372)
LD3DView.AddDirectionalLight(view3D,"White",0.612372,-0.5,-0.612372)
triangle = LD3DView.AddGeometry(view3D,"-0.5 -0.5 0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 0.5","0 1 2 3 4 5","","Red","D")
LD3DView.AddBackImage(view3D,triangle,"","Blue","D")
LD3DView.AnimateRotation(view3D,triangle,1,0,0,0,360,5,-1)
However, there is a
BUG preventing the back material from being correctly added.
I have uploaded the fix to Beta version of LitDev extension version 1.2.26.0
Thanks for reporting!
Posts: 12
Threads: 3
Likes Received:
10 in 8 posts
Likes Given: 29
Joined: Jan 2024
Reputation:
5
Thanks LitDev.
I have just tried this:
LD3DView.SetBackMaterial(view3D, floor, "Yellow", "D")
LD3DView.AddBackImage(view3D,floor,textures,img,"D")
and it also works.
st
Posts: 451
Threads: 34
Likes Received:
359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
01-24-2024, 09:59 PM
(This post was last modified: 01-24-2024, 10:00 PM by litdev .)
Yeah, that also makes sense. AddBackImage adds a layer to back material, SetBackMaterial creates it. The bug was related to adding before creating, the fix was to create and add if it didn't already exist.
Posts: 63
Threads: 9
Likes Received:
41 in 28 posts
Likes Given: 26
Joined: Sep 2023
Reputation:
9
01-26-2024, 07:56 PM
(This post was last modified: 01-26-2024, 08:27 PM by Scout .)
I haven't managed to insert a back image yet. For the solid bodies at least the image passed with AddImage appears; with AddGeometry only the colors appear.
Code:
LDUtilities.CurrentCulture = "en-US"
LDUtilities.Version()
Outside = ImageList.LoadImage (Program.Directory + "\Teich.jpg")'<-----------put ur image here
Inside = ImageList.LoadImage (Program.Directory + "\Rosen.jpg")'<-----------put ur image here
view3D = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
LD3DView.AutoControl("True","True",2,1)
LD3DView.AddDirectionalLight(view3D,"White",-0.612372,-0.5,-0.612372)
LD3DView.AddDirectionalLight(view3D,"White",0.612372,-0.5,-0.612372)
cone =LD3DView.AddPipe (view3D 13 6 8 36 "white" "D")
LD3DView.AddImage(view3D,cone,"",Outside ,"D")
LD3DView.SetBackMaterial(view3D,cone , "Green" ,"D")
LD3DView.AddBackImage(view3D,cone,"", Inside ,"D")
LD3DView.TranslateGeometry (view3D,cone,-5,1,-5)
LD3DView.AnimateRotation(view3D,cone,1,0,0,0,360,15,-1)
triangle = LD3DView.AddGeometry(view3D,"-0.5 -0.5 0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 0.5","0 1 2 3 4 5","","Red","D")
LD3DView.AddImage(view3D,triangle,"",Outside ,"D")
LD3DView.SetBackMaterial(view3D,triangle , "Green" ,"D")
LD3DView.AddBackImage(view3D,triangle,"", Inside ,"D")
LD3DView.TranslateGeometry (view3D,triangle,5,5,-5)
LD3DView.AnimateRotation(view3D,triangle,1,5,1,0,360,5,-1)
cube = LD3DView.AddGeometry(view3D,"-1 1 1 -1 -1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 1 1 -1","0 1 2 2 3 0 4 5 6 6 7 4 8 9 10 10 11 8","","Red","D")
LD3DView.AddImage(view3D,cube,"",Outside ,"D")
LD3DView.SetBackMaterial(view3D,cube , "Green" ,"D")
LD3DView.AddBackImage(view3D,cube,"", Inside ,"D")
LD3DView.TranslateGeometry (view3D,cube,10,10,-5)
LD3DView.AnimateRotation(view3D,cube,1,11,1,0,360,3,-1)
Does anyone have a small demo that displays both images?
Posts: 451
Threads: 34
Likes Received:
359 in 246 posts
Likes Given: 178
Joined: Aug 2023
Reputation:
17
01-26-2024, 09:04 PM
(This post was last modified: 01-26-2024, 09:13 PM by litdev .)
Hi Scout,
Outside (front) is defined by triangle index order, anticlocwise as viewed from the front (2D) or from outside for a 3D shape. Backface is therefore when viewed with clockwise triangle indices.
To view the backface of a 3D object you must be inside looking out. Viewing from the other side is still looking at the outside faces, just from a different direction.
Code:
view3D = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
LD3DView.AutoControl("True","True",2,1)
LD3DView.AddDirectionalLight(view3D,"White",-0.612372,-0.5,-0.612372)
LD3DView.AddDirectionalLight(view3D,"White",0.612372,-0.5,-0.612372)
cube = LD3DView.AddCube(view3D,1,"Red","D")
LD3DView.AddBackImage(view3D,cube,"","Blue","D")
LD3DView.AnimateRotation(view3D,cube,1,0,0,0,360,5,-1)
Above is a cube, with inside coloured blue, to get inside you need to mouse wheel back.
Harder to position inside your tube, but its there for me when viewed from inside it.
Posts: 63
Threads: 9
Likes Received:
41 in 28 posts
Likes Given: 26
Joined: Sep 2023
Reputation:
9
01-26-2024, 09:42 PM
(This post was last modified: 01-26-2024, 09:44 PM by Scout .)
Thanks Litdev
It works !
Code:
LDUtilities.CurrentCulture = "en-US"
Outside = ImageList.LoadImage (Program.Directory + "\Teich.jpg")'<-----------put ur image here
Inside = ImageList.LoadImage (Program.Directory + "\Rosen.jpg")'<-----------put ur image here
view3D = LD3DView.AddView(GraphicsWindow.Width,GraphicsWindow.Height,"True")
LD3DView.AutoControl("True","True",2,1)
LD3DView.AddDirectionalLight(view3D,"White",-0.612372,-0.5,-0.612372)
LD3DView.AddDirectionalLight(view3D,"White",0.612372,-0.5,-0.612372)
cube = LD3DView.AddCube(view3D,1,"Red","D")
LD3DView.AddImage(view3D,cube,"",Outside,"D")
LD3DView.AddBackImage(view3D,cube,"",Inside,"D")
LD3DView.AnimateRotation(view3D,cube,1,1,1,0,360,15,-1)
The sea outside and the roses inside.
What more do you want ?
Attached Files
Thumbnail(s)