This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="uk"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Тест для інструкторів</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
padding: 20px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float2 WorldToScreenPos(float3 pos){ | |
pos = normalize(pos - _WorldSpaceCameraPos)*(_ProjectionParams.y + (_ProjectionParams.z - _ProjectionParams.y))+_WorldSpaceCameraPos; | |
float2 uv =0; | |
float3 toCam = mul(unity_WorldToCamera, pos); | |
float camPosZ = toCam.z; | |
float height = 2 * camPosZ / unity_CameraProjection._m11; | |
float width = _ScreenParams.x / _ScreenParams.y * height; | |
uv.x = (toCam.x + width / 2)/width; | |
uv.y = (toCam.y + height / 2)/width; | |
return uv; |