Posts

Showing posts from 2020

Blender: Cloth Rendering

Image
1) Add a plane mesh 2) Select plane in edit mode, right-click, subdivide 3) Increase number of cuts in bottom left subdivide pop-up 4) Select plane, object mode, physics, cloth 5) Set cloth physics quality steps to 10 6) Under collision, set quality to 5 and check "self collision" 7) Select objects for cloth to fall on, physics, add collision 8) Under the cloth physics -> cache, press bake 9) Click on plane, and add/adjust Subdivision Surface modifier 10) Add solidify modifier to give the sheet some thickness

UE4: Project Folders to Delete for Source Code Repo Uploads

Image
Delete everything from the project except for files in the root folder and the following sub folders (as of Unreal Engine v4.24) Config Content Source Intermediate/ProjectFiles

UE4: Lock Material Texture Tile Size to World Coordinate Space

Image
Increase the WorldScale Vector Parameter (RGB Values) > 1.0 to zoom in on the texture more.

Photoshop: Create Normal Maps

Image
1) Open your original texture in Photoshop 2) Select Image->Adjustments->Black and White 3) Use the following methods to try to get a good contrast between light (high) and dark (low) spots: A) Image->Adjustments->Levels B) Image->Adjustments->Tone Curve C) Image->Adjustments->Exposure 4) Filter->3D->Generate Normal Map

Photoshop: Create Seamless Textures

Image
Tools to build seamless textures in Adobe Photoshop: 1) Crop your source photo to a square resolution (1000x1000 for example). Pick a piece that doesn't have any unique attributes that will stand out in repeat. 2) Adjust the levels, brightness, and contrast to get it as even looking as possible 3) Filter -> Other -> Offset (or Scroll) with horizontal and vertical values half you resolution 4) You need to blend the cross section in the middle without touching the edges of the photo 5) Use the patch tool and healing brush in combination to hide the seams 6) Your source picture should try to keep the same lightness across the whole cropped portion but if not, you can try to compensate by changing your image mode to lab color, and using filter->Other->High Pass to flatten out the color on the luminosity channel.

Elasticsearch: Basic Operations Using Postman / Python

Download Postman:  https://www.postman.com/downloads/ Create a new index: PUT http://servername:port/ indexname Delete an index: DELETE http://servername:port/ indexname Insert data: POST http://servername:port/ indexname Set header to JSON and enter the below in the body for example: {"Insturment":"ct5","Mid":999} Get data: POST http://servername:port/ indexname /_search?size=10000 Get data from python: import requets url = 'http://servername:port/indexname/_search?size=1000' res = requests . get(url) Insert data from python: import requets import json headers = { "Content-Type" : "application/json" } url = 'http://servername:port/indexname/_doc' myMsg = { "doc" :{ "Insturment" : "ct5" , "Mid" : 100 }} res = requests . post(url, headers = headers, data = json . dumps(myMsg))

Unity: VR Head Blocking (Steam VR v2)

Image
Fade color can be changed or disabled to produce a pure wall push back effect on impact. VRHeadBlocking.cs: // VR Head Blocking Script (Synaptic Response) // For use with SteamVR Unity Plugin v2 // Attach to Player -> FollowHead -> HeadCollider and set Tag to "Player" // Initial Implementation: Scott Lupton (04.18.2020) using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; public class VRHeadBlocking : MonoBehaviour { public GameObject player; [SerializeField] bool fadeEnabled = true ; [SerializeField] Color fadeColor = Color.black; private int layerMask; private Collider[] objs = new Collider[ 10 ]; private Vector3 prevHeadPos; private int fadeState = 0 ; private float fadeDuration = . 5f ; private float internalFadeTimer = 0f ; private float backupCap = . 2f ; private void Start () { ...

Unity: Creating a VR Canvas Based HUD

Image
Creating a VR Canvas Based HUD in Unity: This ensures no clipping through world objects by using a second UI camera 1) Create a Canvas object and set the Render Mode to "World Space" 2) Duplicate your VR Camera (under Player->SteamVRObjects->VRCamera) 3) Name this "UICamera" and make it a child of "VRCamera" 4) Unselect "UI" from the VRCamera culling mask 5) Unselect everything but "UI" from the UICamera culling mask 6) Set Clear Flags to "Depth only" and Depth to 1 (higher number than in VRCamera) in UICamera 7) Select "UICamera" as your canvas event camera

UE4: Publishing to the Unreal Marketplace

Image
1) Register as a publisher from:  http://publish.unrealengine.com 2) Create an empty UE4 project (select Game --> Empty Project) 3) Create a uniquely named folder in the content root of the project, and add the assets you want to distribute 4) If you like, also lay out your assets on the example level, save that in the same folder, and set it as the default game and editor level in the product settings 5) After closing down the project, delete the following folders manually: \Binaries \Build \Intermediate \Saved \Content\Collections \Content\Developers 6) Zip the project and host it somewhere online. 7) Submit a request to publish the asset from  http://publish.unrealengine.com

UE4: Make Emissive Material Light Flash

Image
Reference the B branch of the final multiply into the emissive color: here we are multiplying the time by a flash speed scalar parameter and passing it into the Sine function. The output of this is multiplied into the emissive color to adjust the strength. You can increase/decrease the flash speed parameter to adjust how quickly the light flashes.

UE4: Adding Emissive Light to a Part of a Texture

Image
1) Create a copy of the original texture and highlight only the parts that should shine in either red, blue, or green 2) Multiply that texture sample with a vector parameter representing the light color (using the appropriate red, blue, or green channel from the texture to isolate the area to light up) 3) Multiply this by a scalar parameter called emissive strength so that you can pump up this value to make the shine brighter 4) Wire this into the emissive color channel

UE4: Making Materials Shiny

Image
1) Edit your material 2) Add a scalar param node with a default value of 1 wired into the Metallic channel 3) Add a scalar param node with a default value of .5 wired into Specular channel 4) Multiply a scalar param node with a default value of .5 (combined with the texture's alpha channel) into the roughness channel  Lower roughness to increase shine. You can also reduce roughness (or the Metallic value) to reduce the shine. Specular is almost always good at the .5 value.

Unity: Detect VR Mode

Image
Create a new "VRGameController" script as follows: using System . Collections ; using System . Collections . Generic ; using UnityEngine ; using UnityEngine . XR ; public class VRGameController : MonoBehaviour {     [ SerializeField ] GameObject [] disableComponenetsOnVR ;     // Start is called before the first frame update     void Start ()     {         if ( IsXrDevicePresent ()) {             for ( int i = 0 ; i < disableComponenetsOnVR . Length ; i ++) {                 GameObject go = ( GameObject ) disableComponenetsOnVR [ i ];                 go . SetActive ( false );             }         }     }     bool IsXrDevicePresent ()     {         List < XRDisplaySubsystem > xrDisplaySubsystem...

UE4: Load New UI From Button

Image
Use the following blueprint on an event handler to load another UI (Widget Blueprint):

SE: Looping Ambient Clips

Image
1) Download Audacity . 2) Select the portion of the clip you want to loop and press the trim button 3) Cut a piece off the front and paste it into a new track 4) Align the second clip to end just barley after the first 4) Highlight overlap portion of both tracks, and select "Crossfade Tracks" under effects (using "Constant Power 1") 5) Zoom in heavy (where you can see a single line of the sound), fade in the start of the first clip, and fade out the end of the second . This should only be a tiny bit of fade just to keep the clip from popping on the loop border. 6) Shift+space to play in a loop and test 7) Export!

UE4: UI Text Button Hover Color Change

Image
Create transparent button with child Text widget. Expose Text widget as variable and add the following blueprint using the On Hovered and On Unhovered events.