February 16, 2019, 02:23:11 AM

Author Topic: LightMesh  (Read 396 times)

Offline DragonEgg

  • Jr. Member
  • **
  • Posts: 15
LightMesh
« on: January 14, 2019, 08:49:25 PM »
Hi guys
I do not post here very much,but i have been using OpenB3DMax for a while,and wondered if the creator markcwm is still working on it.If so are you/is he thinking of adding LightMesh to it.
thnx guys.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 333
Re: LightMesh
« Reply #1 on: January 15, 2019, 04:14:25 PM »
Hi DragonEgg,

yes I am still working on Openb3dmax and should have an update out soon with LightMesh in it and some examples, I'm just finishing off the new 3DS loader.

LightMesh was just lifted it from the Blitz3d source and it seems to work the same. One thing I noticed is if the LightRange intensity is too high it looks ugly, like sharp vertex shading.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 801
Re: LightMesh
« Reply #2 on: January 16, 2019, 07:32:28 AM »
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline DragonEgg

  • Jr. Member
  • **
  • Posts: 15
Re: LightMesh
« Reply #3 on: January 17, 2019, 08:20:15 PM »
Thank you markcmw nice to no you are still working on OpenB3dMax.
Remid your post is worthless.There is no Lightmesh in OpenB3dMax at the moment.
Which is what im looking for.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 333
Re: LightMesh
« Reply #4 on: January 17, 2019, 08:45:27 PM »
Er, yes LightMesh is now in Openb3dmax. Look again.

Offline DragonEgg

  • Jr. Member
  • **
  • Posts: 15
Re: LightMesh
« Reply #5 on: January 18, 2019, 11:00:15 PM »
Hi markcwm downloaded latest github,build went fine,but when i try to build an example. It throws an error
undefined reference to Log2_.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 333
Re: LightMesh
« Reply #6 on: January 19, 2019, 05:48:32 AM »
Yes sorry, I forgot a file and didn't double-check.

Offline DragonEgg

  • Jr. Member
  • **
  • Posts: 15
Re: LightMesh
« Reply #7 on: January 24, 2019, 01:11:09 AM »
Hi Markcwm
I have used a Blitz3d Lightmesh example by MadJack
and the main sphere looks a bit off,not sure of the problem.
All i am using is CreateSphere()
Thnx

' ------------------------------------------------------------------------------
' WARNING: This code has Not been declared as Public Domain!
' ------------------------------------------------------------------------------

' ID: 249
' Author: MadJack
' Date: 2002-02-27 17:50:12
' Title: Lightmesh And rotation
' Description: Using lightmesh To fakelight a rotating, moving entity

Import Openb3dmax.b3dglgraphics

Graphics3D 800, 600,0,2,60

Local lights:Int [21,10]
    x# = 0
    y# = 0
    z# = 0
   
    ' setup the fakelight markers And place in array - obviously this could be done differently Or with types
    count = 1
    For angle = 0 To 360 Step 36
            ob:TMesh  = CreateSphere(8)

            lights[count,0] = ob
            lights[count,1] = Rnd(50) '; red
            lights[count,2] = Rnd(50) '; green
            lights[count,3] = Rnd(50) '; blue                   
           
      ' position lightmarkers
      EntityColor ob ,lights[count,1]*8,lights[count,2]*8,lights[count,3]*8
      EntityFX ob,1
      ScaleEntity ob, 2,2,2
      PositionEntity ob, Cos(angle)*50,30,Sin(angle)*50

            count = count + 1

    Next

    ' Create mesh To be lit
    Local ball:TMesh = CreateSphere()
    ScaleEntity ball ,20,20,20
    EntityFX ball ,7 ' set flags For fullbright, vertex lighting, flatshaded
           
    Local camera:TCamera = CreateCamera()
    CameraRange camera,1,5000
    PositionEntity camera , 0,100,0
    PointEntity camera,ball

    p2 = CreatePivot() ' this is used in lighting process below
   
   
    'Main LOOP
    While Not KeyHit(key_escape)
   
   x# = (KeyDown(key_left))-(KeyDown(key_right)) + EntityX(ball)
   y# = (KeyDown(key_down))-(KeyDown(key_up)) + EntityZ(ball)
   
    ' move And turn the Object To be lit
    PositionEntity ball,x,0,y   
    TurnEntity ball,1,2,1
       
   'clear Object's vertex color ready for the lightmapping below
   For Local loop=1 To CountSurfaces(ball)
      surf:TSurface=GetSurface(ball,loop)
            For Local vert=0 To CountVertices(surf)-1
                VertexColor surf,vert,0,0,0
            Next
        Next
   
        For count = 1 To 10 '; 10 lights   

'      get light's basic info
            light = lights[count,0]
            Red = lights[count,1]
            Green = lights[count,2]
            Blue = lights[count,3]
 
            xl# = EntityX(light)
            yl# = EntityY(light)
            zl# = EntityZ(light)
       
            yaw# = EntityYaw(ball)
            pitch# = EntityPitch(ball)
            roll# = EntityRoll(ball)   
       
            EntityParent p2,ball
            PositionEntity p2,xl,yl,zl,1 ' place the pivot at the light's global xyz
            RotateEntity ball,0,0,0 ' reset the meshes rotation
   
            x = EntityX(p2) '; get the pivot's new position
            y = EntityY(p2)
            z = EntityZ(p2)


'      do the business
'      a higher range value than 6 will make lights brighter.
'      For larger game worlds, can use something like EntityDistance/3
'      (along with the lights RGB values), To alter brightness

            LightMesh ball,Red,Green,Blue,4,x,y,z   
       
            RotateEntity ball,pitch,yaw,roll ' reset the Object's rotation
   
        Next ' Next light

      UpdateWorld   
      RenderWorld
      
    Text 0,0,"Use Arrow Keys"

    Flip

    Wend
   End



Offline markcwm

  • Sr. Member
  • ****
  • Posts: 333
Re: LightMesh
« Reply #8 on: January 24, 2019, 09:35:24 PM »
Hi DragonEgg,

you just need to use CreateSphere(32) for the main sphere to make it look more subdivided.

Offline DragonEgg

  • Jr. Member
  • **
  • Posts: 15
Re: LightMesh
« Reply #9 on: February 09, 2019, 12:41:26 AM »
Did you look at the demo code the sphere is totally borked.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 333
Re: LightMesh
« Reply #10 on: February 09, 2019, 02:38:32 AM »
Hi DragonEgg,

yes I ran your code and it worked fine, lit just like in Blitz3d. Can you explain what you mean by totally borked?