View Issue Details

IDProjectCategoryView StatusLast Update
0000144Gorilla3D[All Projects] Feature Requestpublic2021-03-09 14:18
ReporteradministratorAssigned Toadministrator 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.8.3.x 
Target Version0.8.3.xFixed in Version0.8.3.x 
Summary0000144: TGorillaLayer3D with the ability of lighting and shading instead of a simple TTextureMaterial
DescriptionAdopt demo changes made for a customer to allow lighting and shading on a Layer3D.
In the demo we modified the TCustomBufferLayer3D.Render (see below)
to setup a TLightMaterial while rendering and setting normals for correct shading.
Additional Informationprocedure TCustomBufferLayer3D.Render;
var
  Ver: TVertexBuffer;
  Idx: TIndexBuffer;
  Mat: TLightMaterial;
begin
  if not FBuffer.IsEmpty then
  begin
    Ver := TVertexBuffer.Create([TVertexFormat.Vertex, TVertexFormat.Normal, TVertexFormat.TexCoord0], 4);
    Ver.Vertices[0] := TPoint3D.Zero;
    Ver.Vertices[1] := TPoint3D.Create(Width, 0, 0);
    Ver.Vertices[2] := TPoint3D.Create(Width, Height, 0);
    Ver.Vertices[3] := TPoint3D.Create(0, Height, 0);

    Ver.TexCoord0[0] := TPointF.Zero;
    Ver.TexCoord0[1] := TPointF.Create(1, 0);
    Ver.TexCoord0[2] := TPointF.Create(1, 1);
    Ver.TexCoord0[3] := TPointF.Create(0, 1);

    Ver.Normals[0] := TPoint3D.Create(0, 0, -1);
    Ver.Normals[1] := TPoint3D.Create(0, 0, -1);
    Ver.Normals[2] := TPoint3D.Create(0, 0, -1);
    Ver.Normals[3] := TPoint3D.Create(0, 0, -1);

    Idx := TIndexBuffer.Create(6);
    Idx[0] := 0;
    Idx[1] := 1;
    Idx[2] := 3;
    Idx[3] := 3;
    Idx[4] := 1;
    Idx[5] := 2;
    Mat := TLightMaterial.Create;
    Mat.Texture := TTextureBitmap(FBuffer).Texture;
    Context.DrawTriangles(Ver, Idx, Mat, AbsoluteOpacity);
    Mat.Free;
    Ver.Free;
    Idx.Free;
  end;
end;
TagsNo tags attached.
Delphi-Version 10.4.1
OpenGLVersionOpenGL 4.3

Activities

administrator

2021-03-09 14:18

administrator   ~0000161

fixed

GorillaLayer3D now provides a "Shading" property to set: flat, lambert, phong, blinn-phong shading
Normals added to plane

Issue History

Date Modified Username Field Change
2021-03-08 16:20 administrator New Issue
2021-03-08 16:20 administrator Status new => assigned
2021-03-08 16:20 administrator Assigned To => administrator
2021-03-09 14:18 administrator Status assigned => resolved
2021-03-09 14:18 administrator Resolution open => fixed
2021-03-09 14:18 administrator Fixed in Version => 0.8.3.x
2021-03-09 14:18 administrator Note Added: 0000161