Borrowed from Fish Eye Quake
First attempts http://alphaone.teaminfamy.net/pics/FishEyeTest1.png?wikihack
Thats a FOV of 170!
For compartions of normal and fisheye projection FOVs, see this:
Non Code Stuff
http://alphaone.teaminfamy.net/pics/FishEyeShader.png?wikihack
http://alphaone.teaminfamy.net/pics/FishEyeMesh.png?wikihack
Crappy Code
This code makes it barely work:
class FishEyeScreenActor extends Actor; var PlayerController ownerViewer; var() ScriptedTexture DestTexture; var() name CameraTag; var() float RefreshRate; var() float FOV; var() float ScreenViewDistance; // lots of coded ripped from CameraTextureClient... simulated function PostBeginPlay() { DestTexture = ScriptedTexture(Level.ObjectPool.AllocateObject(class'ScriptedTexture')); if(DestTexture != None) { DestTexture.Client = Self; DestTexture.SetSize(1024,1024); Skins[0] = DestTexture; SetTimer(1.0 / RefreshRate,true); Enable('Timer'); } } simulated function Timer() { DestTexture.Revision++; } function Tick(float DeltaTime) { local vector screenOffSet; super.Tick(DeltaTime); if(ownerViewer != none) { SetRotation(ownerViewer.Rotation); screenOffSet = vector(Rotation) * ScreenViewDistance; if(ownerViewer.Pawn != none) { SetLocation(ownerViewer.Pawn.Location + screenOffSet + ownerViewer.Pawn.EyePosition()); } else { SetLocation(ownerViewer.Location + screenOffSet); } } } simulated event RenderTexture(ScriptedTexture Tex) { local vector screenOffSet; local vector fishCameraLocation; local rotator fishCameraRotation; local actor fishCameraActor; /*if(ownerViewer != none) { screenOffSet = vector(ownerViewer.Rotation) * ScreenViewDistance; fishCameraRotation = ownerViewer.Rotation; fishCameraActor = ownerViewer; fishCameraLocation = -screenOffSet; if(ownerViewer.Pawn != none) { fishCameraLocation += ownerViewer.Pawn.Location + ownerViewer.Pawn.EyePosition(); } else { fishCameraLocation += ownerViewer.Location; } } else {*/ fishCameraActor = self; fishCameraLocation = Location; fishCameraRotation = Rotation; //} Tex.DrawPortal(0,0,Tex.USize,Tex.VSize,fishCameraActor,fishCameraLocation,fishCameraRotation,FOV); } simulated event Destroyed() { if (DestTexture != None) { DestTexture.Client = None; Level.ObjectPool.FreeObject(DestTexture); } Super.Destroyed(); } defaultproperties { ScreenViewDistance = 160 bUnlit = true bStatic = false bAlwaysRelevant = true bNoDelete = false RefreshRate = 60 FOV = 170 DrawType = DT_StaticMesh StaticMesh = StaticMesh'FishEyeMeshes.Sphere2' DestTexture = ScriptedTexture'FishEyeTex.Screen2' bHardAttach = true }
class FishEyeInt extends interaction; var bool bFishEyeActive; var FishEyeScreenActor FishEyeScreenObject; function Initialize() { if(ViewportOwner.Actor != none) { // called after being attached to the PC FishEyeScreenObject = ViewportOwner.Actor.Spawn(class'FishEyeScreenActor', ViewportOwner.Actor, , ViewportOwner.Actor.Location, ViewportOwner.Actor.Rotation); FishEyeScreenObject.ownerViewer = ViewportOwner.Actor; //FishEyeScreenObject.SetBase(ViewportOwner.Actor.Pawn); } } // ============================================================================ function PostRender(canvas Canvas) { Canvas.SetPos(0,100); Canvas.Font = Canvas.TinyFont; Canvas.SetDrawColor(255,255,255,255); if(bFishEyeActive) { Canvas.DrawText("FishEye active"); Canvas.SetPos(Canvas.SizeX, Canvas.SizeY); Canvas.DrawActor(FishEyeScreenObject,false,false); } else { Canvas.DrawText("FishEye not active"); } } // modified, from http://wiki.beyondunreal.com/wiki/Keypress_Interactions function bool KeyEvent(EInputKey Key, EInputAction Action, float Delta) { local string tmp; if (Action == IST_Release && FishEyeScreenObject != none) { tmp = ViewportOwner.Actor.ConsoleCommand("KEYNAME"@Key); tmp = ViewportOwner.Actor.ConsoleCommand("KEYBINDING"@tmp); if (tmp == "use") { bFishEyeActive = !bFishEyeActive; //FishEyeScreenObject.bHidden = !FishEyeScreenObject.bHidden; return True; } } // this event doesn't matter to us, so we pass it on for further processing return False; } defaultproperties { bVisible = true bFishEyeActive = false }
Page Information
2022-11-20T20:18:38.646274Z
2004-09-04T15:34:20Z
Plouj
*
https://wiki.beyondunreal.com/Legacy:AlphaOne/FishEyeView
Attribution-NonCommercial-ShareAlike 3.0