I’m all for an object like this for organisation purposes! Thing that I might want to suggest tho is the ability to point at any LightingObject instance from within a ViewportFrame, similar to how an Adornee property works, to be able to specify how the lighting should look using common objects, or maybe even the Lighting service itself if Lighting were to extend this object.
In any case this should probably be made into a separate suggestion thread.
Unfortunately I’m not allowed to make posts in suggestions, I think it’s because I haven’t made any new topics yet since I’m still trying to grasp how the devforum works.
Also if you enlarge the image you will see that there is an Adornee for any LightingObject (also yeah, it’ll probably just be that you can insert multiple Lightings vs a unique object for it)
(The only reason I thought of making them separate objects was because of the new “Future is Bright” which I believe shouldn’t really be used for ViewportFrames since like previously stated, weren’t really intended for massive HD projects.)
Viewport frames are pretty cool! I’ve been using them instead to replace images of models. But I’ve just found a bug when a model in a viewport frame has surface guis on it. When i put the model in a viewport frame, the surfaceguis on the model make a strange rendering artifact in game.
Model in workspace:
Model in viewport frame:
And when i try to select something a frame that is in the surfacegui, it does this:
You can even see it in game!
Now it is easy to fix, (just remove the surface gui for the model in the viewport frame) but i think it still should be mentioned… (Also, I would post this in engine bugs, but i’m a new user so i can’t post there and imo this is the best thread to post this on since it’s on viewport frames.)
Have you heard of the glass material bug with transparency? You can replicate that effect with that as well, but it’s a matter of preference. I think the glass alternative looks better but it’s also going to be patched according to Roblox, so.
That’s because multiple ViewportFrames can use the same camera. Since ViewportFrames can have different sizes, there’s no way to decide which size to use.
Here’s some code from a module I wrote, which was borrowed from another module by someone else:
local function pointToScreenSpace(cframe, fieldOfView, point, viewportSize)
-- borrowed from https://devforum.roblox.com/t/3d-gui-module/5183 ( http://www.roblox.com/Roblox-3D-GUI-Module-item?id=159576724 )
-- used for transforming points from GetCameraParams into a size
-- no need to rewrite what's already written!
local screenSize = viewportSize
local relative = cframe:pointToObjectSpace(point)
local ratio = screenSize.x/screenSize.y
local yFactor = math.tan(math.rad(fieldOfView/2))
local xFactor = ratio*yFactor
local y = (relative.y/relative.z) / yFactor
local x = (relative.x/relative.z) / -xFactor
return Vector2.new(screenSize.x*(0.5 + 0.5*x), screenSize.y*(0.5 + 0.5*y))
end