Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Specular Light

  1. #1
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    45
    Posts
    914
    Rep Power
    101

    Specular Light

    Hi all

    Have a little question about 'Specular Light' (Ambient, Spotlight) and Entity Creations...

    TBGL_EntityCreateSpecularLight(%sScene, %eSpecularLight)
    does this one exists with tbgl entity language???

    The light range, attenuation, ambient, diffuse, spotlight light does run also with entity system???

    Didn't found any example for it, sorry... need it for a new project

    best regards, Lionheart

    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694

    Re: Specular Light

    Hi Frank,

    entity system currently supports just diffuse and ambient color for light.
    So you create light like usually, using TBGL_EntitySetColor (this is hybrid function for all entities) you set diffuse color of that light, and using TBGL_EntitySetAmbient you can set ambient color.

    Light range (in meaning light is applied only in radius) can be done only via shaders, hardware lights work with the attenuation equation. That means light never reaches zero propagation, it just becomes weaker and weaker.

    Spotlight is easy to do, when you look in help file, you can see you can specify which type of light you need - point, directional or spotlight. Spotlight can have specified angle and sort of attenuation factor called border fade.

    So only thing not implemented now is attenuation and specular part of the light, will see what I can do
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  3. #3
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    45
    Posts
    914
    Rep Power
    101

    Re: Specular Light

    Hi Petr,

    ' -- Create point light
    TBGL_EntityCreateLight(%sScene, %eLight)
    TBGL_EntitySetColor(%sScene, %eLight, 50, 50, 255)
    '-TBGL_EntitySetSpecular(%sScene, %eLight, 50, 50, 255)
    TBGL_EntitySetAmbient(%sScene, %eLight, 250, 50, 255)
    TBGL_EntitySetPos(%sScene, %eLight, 15, 10, 5)
    this light examples exist if I have understood you well... without specular... it's ok... so I have tried it some hours before without success...

    thank you for the info

    I will build an reference tbgl example with primitives, movements and lights all things they are actual possible with tbgl features of thinbasic 1.7.5.0

    shadows will come at a later time, won't be able, so I am thinking (with stencil buffer perhaps...), isn't it???

    ciao and servus, Lionheart
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694

    Re: Specular Light



    Yes, what you wrote will work perfectly.
    For spotlights just:
    TBGL_EntityCreateLight(%sScene, %eSpotLight, 0, %TBGL_LIGHTTYPE_SPOT)
    TBGL_EntitySetCutoff(%sScene, %eSpotLight, 15) ' -- cut off angle
    TBGL_EntitySetBorderfade(%sScene, %eSpotLight, 25) ' -- Softer edges of the circle produced
    And the best of all - as spotlight is entity, you can attach it to model of car, so it moves with it automagically...
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  5. #5
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    45
    Posts
    914
    Rep Power
    101

    Re: Specular Light

    :-)

    hi petr, hi all...

    shame upon me, but I have got some errors I cannot see the mistake

    a) would like to "move" (turn, push, entity) the cylinder or box... but how can I do this with

    If TBGL_GetWindowKeyState(hWnd, %VK_LEFT) Then TBGL_EntityPush(%sScene, %eBox, 0, 90/FrameRate, 0)
    that it can run clearly as I wish??? know that hWnd and frameRate is missing to define...

    b) have a double rendered picture... see not the problem here... perhaps I am blind

    c) would like to animate one object by button click with a step by time factor 10 or 100 and then stop it... somebody has an example for it???

    that's all for the moment...

    best regards, Lionheart
    ps: have deleted the example for a well running script you can see below :-D
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	mistake-rendering+push-question1b.jpg 
Views:	111 
Size:	32.8 KB 
ID:	5411  
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694

    Re: Specular Light

    Hi Lionheart,

    I am too much under influence of school exam hell, so I will give you hints in form of test

    - In your RenderMyImage, where is TBGL_ClearFrame ( very related to b] ), where should you put it?
    - hWnd is to TBGL window, as h??? to TBGL control ( very related to a] )
    - FrameRate is defined in RenderMyImage as STATIC, how to make it visible from everywhere ( very related to a] ) ?

    Hehe, I hope you can see the answers now, if not ... I will make normal reply
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  7. #7
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    45
    Posts
    914
    Rep Power
    101

    Re: Specular Light

    hi petr hi all,

    ...solved it, as I am working again with 'thinair' and not with a pure texteditor... where I cannot see my mistakes !!! must laugh

    yes, I know my little problems... forgotten tbgl_clear frame and has to change my 'hWnd' (has nothing to do with my example) into '%sScene' tbgl language... brrr... my head is full of cold water... :-D

    with up, down, right, left, page down, page up you can now move the box !

    everything is ok for me now...

    bye, thanks for your hints, I need it to awake :-D, best wishes, Lionheart

    edit: have fixed the current script at this place with a second sphere and with a little other push entity
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	solved-problem-primitives-light-example.jpg 
Views:	95 
Size:	33.2 KB 
ID:	5412  
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694

    Re: Specular Light

    Hi Frank,

    good job!

    Just with that TBGL_GetWindowKeyState it is still formally wrong.

    The correct answer to "hWnd is to TBGL window, as h??? to TBGL control ( very related to a] )" is:
    "hWnd is to TBGL window, as hCtrl to TBGL control ( very related to a] )"

    Thanks,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  9. #9
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    45
    Posts
    914
    Rep Power
    101

    Re: Specular Light

    Hi petr

    good to know, doesn't try it before with tbgl entities and
    If TBGL_GetWindowKeyState(hctrl, %VK_LEFT) Then TBGL_EntityTurn(%sScene, %eBox, 0, 90/FrameRate, 0)
    thank you! fixed my script with 'hctrl'. So every day it's a good day when I can learn for minimum five cents fixed the little problem with hctrl in my last post !

    prosit

    Xavier Lionheart (X-Men Leadership)
    often some humour here is missing at the board...

    ps: it's possible to get more kinds of smileys???
    Attached Images Attached Images    
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,198
    Blog Entries
    2
    Rep Power
    10

    Re: Specular Light

    Quote Originally Posted by Lionheart008
    ps: it's possible to get more kinds of smileys???
    I will try to see what I can do.
    In the meantime click on [more] link just right to basic smiles.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Page 1 of 2 12 LastLast

Similar Threads

  1. Going into the light
    By danbaron in forum Shout Box Area
    Replies: 1
    Last Post: 02-04-2011, 00:49
  2. Earth-Like planet 20 light years away
    By Charles Pegge in forum Shout Box Area
    Replies: 17
    Last Post: 15-10-2010, 01:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •