Custom 3D GUI Game Engine With Textures

Hey uhh, What does FovPart Represent?

Also is there an alternitive to Pi? or is there a way to convert radians or degress to pi? Cause I know nothing about Pi

1 Like

FovPart is this variable I just made above it.

local FovPart = GetFovFromIndex(i)

using the only function I have listed.

also yeah you can totally convert degrees, which is what roblox’s vector3 uses, into radians, which is what pi uses.

If you want to convert a degree number to a radians number all you have to do it say math.rad(MyDegrees) and if you want to convert a number in radians to degrees simply do the reverse: math.deg(MyRadians)

I’ve tried this, and nothing seems to have changed:

local Distance = (ViewRayOrigin - ViewRay.Position).Magnitude -- ViewRay is the RaycastResult

-- Remove that fisheye effect		
local RayAngleX, RayAngleY, RayAngleZ = RayAngle:ToEulerAnglesXYZ()	
local PlayerAngleX, PlayerAngleY, PlayerAngleZ = CameraPart.CFrame:ToEulerAnglesXYZ()	
			
Distance = Distance * math.cos(math.rad(PlayerAngleY) - math.rad(RayAngleY))
1 Like

you are slowly turning into egomoose and I love it

3 Likes

I feel like the fisheye adds for effect to the PS1 style since the fat TV’s we’re square and curved

2 Likes

I am unsure if the fisheye lens fix will even work for your method. But when I was working on my 2D Raycast Renderer I also asked for some help, here’s what @edenojack had to say:

Specifically, the video relating to Wolfenstein’s way of clearing the effect. It’s been a while since I last watched the video, so I am no longer sure what the fix was but I do know that you can see major improvements from my first rendition to my second version of the raycaster:
https://www.roblox.com/games/3608191441/2D-Raycast-Renderer


Also, Grazi

1 Like

The video in the linked post should help actually, specifically from here;

It sounds like you’ve found the position you’ve hit the object, and are just having a little bit of issue with the adjustments to the FOV, this video should help descibe the equations and reasons behind what you’ll need to do next.

2 Likes

I’ve almost fixed the fisheye effect

But there is a new distortion now.
It appears that the higher the angle is, the taller the walls will strech.

image

This is more obvious with higher FOV

image

Anyone know why this is?

local Distance = (ViewRayOrigin - ViewRay.Position).Magnitude

-- Remove that fisheye effect		
local RayAngleX, RayAngleY, RayAngleZ = RayAngle:ToEulerAnglesXYZ()	
			
Distance = Distance * math.cos(RayAngleY)
1 Like

I know this isn’t relevant right now but does this support meshes?

1 Like

yes, but you wont get a 3D model. You have to remember that this is actually a 2D top-down map.

It is just being rendered to look like its 3D. This explains why you cannot look up or down as well.

image

3 Likes

Ah I see, that would make sense.

I seem to have a major FPS drop when I walk into walls.

1 Like

That’s odd. I can’t seem to reproduce that issue.

I’m also planning on redoing wall collisions overall. Hopefully that will fix your issue.

I just rejoined and it didn’t happen this time, weird.

It may have happened after I messed around with settings and then I reset my character.

Hey so I was playing around and found that you can get the equivalent of CharacterAngle by simply:

local CharacterAngle = math.rad(-CharacterPart.Orientation.Y)

This is actually intended behavior.

Imagine that your FOV is 360, you would be able to see all around you. The problem then becomes how could you possibly represent those straight lines all around you without curving them? You can’t.

That sort of opposite fish eye effect happens when your FOV is too high for the width of the screen. Frankly I reccomend you just widen the viewport.

Wow. That is cool. How does it run so well?

1 Like

I am trying this thing out as soon as I get on my computer in the morning!
Bet it would be possible to create a awesome Puppet Combo game remaster.

Great job! :+1:

1 Like

huh. Well I finally got your formula to work, but I get the exact outcome as using my other method. Which means curve on the outside.

local Distance = (ViewRayOrigin - ViewRay.Position).Magnitude

-- Remove that fisheye effect		
local RayAngleX, RayAngleY, RayAngleZ = RayAngle:ToEulerAnglesXYZ()	
local CameraAngleY = math.rad(-CameraPart.Orientation.Y)	
			
Distance = Distance * math.cos(RayAngleY - math.rad(CameraAngleY))

Is there a way to fix this without changing the viewport size?

Okay just had an idea.
Aside fomr keeping your FOV low, you could possibly simulate a wider viewport but only display the box.
That would remove the effect.

Although now that I’m thinking about it, that’s literally just the same as keeping your FOV low.