generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Lighting Algorithm

Previous Thread :: Next Thread 
Redyz is not online. Redyz
Joined: 27 Dec 2007
Total Posts: 660
15 Oct 2011 03:08 PM
Hello,

I have a question; I possess a script that changes the time automatically using a set algorithm, thus there is a day and night cycle.

I would like to have the ambient lighting to somewhat follow the normal "real life" shadow process.

What would be the nicest way to set that accordingly?

I believe the "Ambient" property is a Color3 value, my question is simply; how do I set this nicely according to TimeOfDay which is a completely different object?

Thank you,
-Redyz
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
15 Oct 2011 03:13 PM
[ Content Deleted ]
Report Abuse
Redyz is not online. Redyz
Joined: 27 Dec 2007
Total Posts: 660
15 Oct 2011 03:23 PM
Thank you I suppose, but it doesn't really solve my problem..
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
15 Oct 2011 03:34 PM
When I use Color3 values, I use the BrickColor data type. This data type has a property called 'Color' which converts the BrickColor into a Color3 value.

Ex:

gui = script.Parent
gui.BackgroundColor3 = BrickColor.new('Bright blue').Color

~Flurite, ROBLOX Wiki Writer
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
15 Oct 2011 03:47 PM
BrickColor are for people who can't use hexadecimal.
Report Abuse
Redyz is not online. Redyz
Joined: 27 Dec 2007
Total Posts: 660
15 Oct 2011 04:06 PM
Yeah well, I'd use brickcolor as a last resort;

I can deal with hex I guess but that doesn't solve my algorithm problem.
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
15 Oct 2011 04:19 PM
s=math.floor(tick()%60)
m=math.floor(tick()/60%60)
h=math.floor(tick()/3600 % 24)
game.Lighting.TimeOfDay=h..":"..m..":"..s
while true do
rawambient=math.floor(tonumber(string.sub(game.Lighting.TimeOfDay,1,2)/0.094117))
print(rawambient)
ambient=0
if rawambient > 128 then ambient = -rawambient else ambient=rawambient end
print(ambient)
game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+2)
game.Lighting.Ambient=Color3.new(-ambient,-ambient,-ambient)
wait()
end

Does the trick for me.
Report Abuse
Redyz is not online. Redyz
Joined: 27 Dec 2007
Total Posts: 660
16 Oct 2011 01:52 PM
@Fl0x

That's a start, it's not very smooth but I can definitely try to work it out.

Thank you.
Report Abuse
Redyz is not online. Redyz
Joined: 27 Dec 2007
Total Posts: 660
16 Oct 2011 02:53 PM
I tried making my own but roblox seems to ignore most of my lighting settings, when I set it at (0,0,0) it only applies it (ingame that is, the property appears set) every now and then.

It acts funky and I'm wondering if the ambient parameter has restrictions about how many times you can set it during X time or something along those lines..
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
16 Oct 2011 03:16 PM
Changing the ambient is like changing the sky color from blue to green - it just isn't natural. You should use Brightness to adjust darkness and daylight settings rather than color-coat the world.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image