Browsing articles in "scripts"
May
25
2019

Enable HDR Color picker for Shader or Script

I needed HDR color for some old Unlit/Color-shader, and for c# script also, found out that you can add this attribute for the shader: And for the script: More info:https://docs.unity3d.com/ScriptReference/ColorUsageAttribute.htmlhttps://docs.unity3d.com/Manual/SL-Properties.html Also make sure your Camera has [x] HDR enabled

May
23
2019

Scrolling Texture Plotter using CustomRenderTexture

Saw interesting question in the forums (link) about drawing plotter like data that would scroll up, got idea about custom rendertextures (since it was similar to this effect) Basic idea: – use CustomRenderTexture, double buffered so it can read from itself – draw color32 array […]

May
12
2019

Using SharpCompress in Unity

If you need to work with zip/rar/tar/gzip packages, can use SharpCompress to handle opening or creating those files. Compile SharpCompress DLL (unless you can find it online somewhere) Download project https://github.com/adamhathcock/sharpcompress Unzip and open in VisualStudio (i used 2017) Security warning, press ok Security warning, […]

May
9
2019

FAST-Algorithm for Corner Detection in Unity

Converted this (basic) algorithm into Unity c# https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_fast/py_fast.html FAST (Features from Accelerated Segment Test) is a way to detect corner features from an image. Source: *not optimizedhttps://gist.github.com/unitycoder/7649f62a6eceeb761db7f0092d9c3df1

May
6
2019

Ray Marching

Tested ray marching in Unity after watching this episode of The Coding Train. Source code:https://gist.github.com/unitycoder/7120e492deba748dba3d4e1e424d3c2a Usage:Set camera to 0,0,-10Projection: OrthographicThen Place spheres under empty gameobject, with sphere z values at 0

Apr
4
2019

RANSAC 2D Line Fitting

Converted this RANSAC 2D line fitting pseudocode into Unity c# http://www.visual-experiments.com/demo/ransac.js/ What is RANSAC? https://en.wikipedia.org/wiki/Random_sample_consensus Source code:https://gist.github.com/unitycoder/53495435c28853ef6522ff60d5c6a091 *Note this is not optimized at all, just a quick test Usage instructions:– Add this script to empty gameobject– Add gameobjects as a child of that gameobject (place […]

Oct
31
2018

Find Nearby Objects using CullingGroup

Saw this tip at #UniteKL18, fast way to get nearby objects using CullingGroup! (main image with 5000 gameobjects, searching objects within 3m radius) example source code: https://github.com/UnityCommunity/UnityLibrary/blob/master/Assets/Scripts/Docs/UnityEngine/CullingGroupExample.cs my example project: https://github.com/unitycoder/GetNearestObjectsWithCullingGroup Some notes on that: – You need to have MainCamera in the scene (as […]

Oct
3
2018

Convolution Filter Test

Quick test for simple convolution filter with unity Texture2D (using c# script, not shader) Source project: https://github.com/unitycoder/ConvolutionFilter  

May
18
2018

Quadtree

Converted this javascript quadtree (by The Coding Train) to Unity using texture2d *not complete with all the features yet though, but can add points by clicking texture with mouse. Unity Project https://github.com/unitycoder/UnityQuadtreeInTexture   Original source https://www.youtube.com/watch?v=OJxEcs0w_kE  

Aug
27
2017

Drawing Lines

Hi dear reader! In this tutorial we want to learn how to draw a line in unity by user mouse movement and interaction. First we need a component that would be able to render simple lines. Our choice is ​Line Renderer​, this component is able […]

Pages:«1234»

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.