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 » Scripters
Home Search
 

Re: Percent Shaded?

Previous Thread :: Next Thread 
Dinobird is not online. Dinobird
Joined: 29 Apr 2009
Total Posts: 213
02 Jun 2015 02:11 AM
How would I tell how much percent of the block is shaded? Also, how would I tell if a part would be blocking another from sunlight?
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
02 Jun 2015 02:28 AM
You can't tell unless you made some kind of shade script.

local surface_area = 25
local shaded = 12

local percent = math.floor((shaded/surface_area)*100)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Jun 2015 02:40 AM
He's talking about the Roblox sun and another object.
And it is possible to figure out, I just don't know how since math
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
02 Jun 2015 03:06 AM
The best way to do this exactly would be with a polygon bit operation library. What are you going to use this for?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jun 2015 07:19 AM
GetSunDirection
Raycasting
Brightness





Those might help.
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Jun 2015 07:30 AM
From my thinking you would need the time of day, size of the block, position and angle of the sun, and lost of math. Of course some things I mentioned may be needed to calculated at any time of day at any points but that would require you have some way to calculate and plug in a lot of variables. In short, I cannot see any reason as to why you would want this, or why you would want to waste computation power. I suggest trying to find a different solution to the problem you are thinking about. Not to say its not possible but the work required to figure it out may not be worth it.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jun 2015 07:36 AM
@Earthy


GetSunDirection

...
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
02 Jun 2015 07:56 AM
@warspyking

Good to know, but still no closer to having a solution.
Report Abuse
Dinobird is not online. Dinobird
Joined: 29 Apr 2009
Total Posts: 213
02 Jun 2015 10:14 AM
Thanks for all your replies, and what I could do is find the difference in angles and give it more energy if the angle is closer to 90 degrees (direct sunlight is easiest to get energy from)

What I'm working on is a virtual Darwinian evolution for flora. It works as things reproduce, but unrealistic results come into play, so I'm trying to make it as realistic as I can.
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
02 Jun 2015 11:32 AM
You could use the dot product of the surface normal of the surface and the vector between the sun and part to determine about how much the part is facing the sun. If the surface isn't visible to the sun, then it can be determined that it isn't visible to the sun. This is also known as back face culling and is used in 3D computer graphics.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
02 Jun 2015 12:59 PM

This is not called backface culling.

Culling is the act of not rendering a face of a polygon. Each polygon you draw in space has two sides. A front and a back. When drawing your polygon, specifying points matter because you are telling whether or not it is a front or back triangle. Counter clockwise means front, clockwise means back.. This is what determines if a polygon should be drawn.

If lighting was determined by DOT product then we would have an extra FPS * Vertex calls each second cycle. (Basically processing collision (which lags) all over again)
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
02 Jun 2015 01:38 PM
I really don't know what I meant by saying use backface culling anymore. lol
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
03 Jun 2015 01:54 AM
Rekt
Report Abuse
T0W3R is not online. T0W3R
Joined: 13 Jul 2011
Total Posts: 384
03 Jun 2015 01:56 AM
I'm quite curious in why you would need a 'percent shaded' script.
If you could tell me that'd be great.
Report Abuse
Dinobird is not online. Dinobird
Joined: 29 Apr 2009
Total Posts: 213
06 Aug 2015 01:00 PM
If you were wondering why I needed it, I'm making an artificial evolution script with plants. I would like to have an accurate shaded percent to determine how efficient the organism is at producing energy. I could use ray casting, but I would have to use multiple so that it detects parts that aren't directly between the leaf's center and the sun.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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