Categories
Game Creation Mastering Development

Mobile Unity Shader – how to work with on/off boolean

How do you set a boolean for a shader? How do you write a conditional or assign a boolean in a shader? So, it seems that shaders do not take booleans… so I tried assigning the float to 0 or 1 ren.material.SetFloat(“_ZWriteVal”, 1f);, but it doesn’t seem to work… Shader “ZTestLess” { Properties { _Color […]

Categories
Mastering Development

Unable to draw on images using namedWindow in Python

An image opens on running my code in terminal or in Spyder. But there is no action on doing either left or right click. Here is the code I’ve written: import cv2 import matplotlib.pyplot as plt def drawCircle(event,x,y,flags,param): if event == cv2.EVENT_LBUTTONDOWN: #(If Left button of mouse clicked) cv2.circle(img,(x,y),radius = 100, color =(255,0,0),thickness=-1) if event […]

Categories
Game Creation Mastering Development

Unity mesh shader for outlining colour changes

I’ve written a shader to change colour on a deformable mesh’s Z position. This is to create the effect of topographic/contour maps where the colour changes based on the height of terrain of the mesh. This is it viewed from the side And viewed head-on (as it’s meant to be) What I need is for […]

Categories
Development Game Creation

Is there a way to get a shader circle on terrain points positions?

Using this I can draw a circle shader over the terrain : Shader “Custom/TerrainCircle” { Properties { _MainTex(“Texture”, 2D) = “white” {} _MainColor(“Main Color”, Color) = (0, 1, 0) _CircleColor(“Circle Color”, Color) = (1, 0, 0) _Center(“Center”, Vector) = (0,0,0,0) _Radius(“Radius”, Range(0, 100)) = 10 _Thickness(“Thickness”, Range(0, 100)) = 5 } SubShader { CGPROGRAM #pragma […]

Categories
Mastering Development

Is there any other way to create obstacles in a snake game in python?

I’m trying to create a python program for a snake game with obstacles… I am able to create obstacles one by one like import pygame import math import random import sys import tkinter as tk from tkinter import messagebox class cube(object): rows = 20 w = 500 def __init__(self,start,dirnx=1,dirxny=0,color=(255,0,0)): self.pos = start self.dirnx = 1 […]

Categories
Development Game Creation

Shader intersection radiate outwards

I’ve been working on a water shader for a project I’m currently working on and have been trying to work on the intersections between objects in the water to create a foam effect that radiates outwards. I’m very new to shaders so my code is probably horribly inefficient! But here it is: Shader “Unlit/WaterShader” { […]

Categories
Development Game Creation

Shader intersection radiate outwards

I’ve been working on a water shader for a project I’m currently working on and have been trying to work on the intersections between objects in the water to create a foam effect that radiates outwards. I’m very new to shaders so my code is probably horribly inefficient! But here it is: Shader “Unlit/WaterShader” { […]

Categories
Development Game Creation

Shader intersection radiate outwards

I’ve been working on a water shader for a project I’m currently working on and have been trying to work on the intersections between objects in the water to create a foam effect that radiates outwards. I’m very new to shaders so my code is probably horribly inefficient! But here it is: Shader “Unlit/WaterShader” { […]

Categories
Development

Making TMPro shader compatible with LWRP

In my unity Project, here is the code for TMpro shader: Shader “TextMeshPro/Distance Field” { Properties { _FaceTex (“Face Texture”, 2D) = “white” {} _FaceUVSpeedX (“Face UV Speed X”, Range(-5, 5)) = 0.0 _FaceUVSpeedY (“Face UV Speed Y”, Range(-5, 5)) = 0.0 _FaceColor (“Face Color”, Color) = (1,1,1,1) _FaceDilate (“Face Dilate”, Range(-1,1)) = 0 _OutlineColor […]

Categories
Development

GLFW GLSL OPENGL ISSUES

this is one of several attempts on building a simple openGL renderer using GLFW i took out the error checks using GL_INFO_LOG_LENGTH and stuff and i basically use all the ARB versions of the things in my code, but for readability i took it out. i have only one code that seems to work half […]